proteus  1.7.4
C/C++/Fortran libraries
MeshSmoothing.cpp
Go to the documentation of this file.
1 /* Generated by Cython 0.29.16 */
2 
3 #define PY_SSIZE_T_CLEAN
4 #include "Python.h"
5 #ifndef Py_PYTHON_H
6  #error Python headers needed to compile C extensions, please install development version of Python.
7 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
8  #error Cython requires Python 2.6+ or Python 3.3+.
9 #else
10 #define CYTHON_ABI "0_29_16"
11 #define CYTHON_HEX_VERSION 0x001D10F0
12 #define CYTHON_FUTURE_DIVISION 0
13 #include <stddef.h>
14 #ifndef offsetof
15  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
16 #endif
17 #if !defined(WIN32) && !defined(MS_WINDOWS)
18  #ifndef __stdcall
19  #define __stdcall
20  #endif
21  #ifndef __cdecl
22  #define __cdecl
23  #endif
24  #ifndef __fastcall
25  #define __fastcall
26  #endif
27 #endif
28 #ifndef DL_IMPORT
29  #define DL_IMPORT(t) t
30 #endif
31 #ifndef DL_EXPORT
32  #define DL_EXPORT(t) t
33 #endif
34 #define __PYX_COMMA ,
35 #ifndef HAVE_LONG_LONG
36  #if PY_VERSION_HEX >= 0x02070000
37  #define HAVE_LONG_LONG
38  #endif
39 #endif
40 #ifndef PY_LONG_LONG
41  #define PY_LONG_LONG LONG_LONG
42 #endif
43 #ifndef Py_HUGE_VAL
44  #define Py_HUGE_VAL HUGE_VAL
45 #endif
46 #ifdef PYPY_VERSION
47  #define CYTHON_COMPILING_IN_PYPY 1
48  #define CYTHON_COMPILING_IN_PYSTON 0
49  #define CYTHON_COMPILING_IN_CPYTHON 0
50  #undef CYTHON_USE_TYPE_SLOTS
51  #define CYTHON_USE_TYPE_SLOTS 0
52  #undef CYTHON_USE_PYTYPE_LOOKUP
53  #define CYTHON_USE_PYTYPE_LOOKUP 0
54  #if PY_VERSION_HEX < 0x03050000
55  #undef CYTHON_USE_ASYNC_SLOTS
56  #define CYTHON_USE_ASYNC_SLOTS 0
57  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
58  #define CYTHON_USE_ASYNC_SLOTS 1
59  #endif
60  #undef CYTHON_USE_PYLIST_INTERNALS
61  #define CYTHON_USE_PYLIST_INTERNALS 0
62  #undef CYTHON_USE_UNICODE_INTERNALS
63  #define CYTHON_USE_UNICODE_INTERNALS 0
64  #undef CYTHON_USE_UNICODE_WRITER
65  #define CYTHON_USE_UNICODE_WRITER 0
66  #undef CYTHON_USE_PYLONG_INTERNALS
67  #define CYTHON_USE_PYLONG_INTERNALS 0
68  #undef CYTHON_AVOID_BORROWED_REFS
69  #define CYTHON_AVOID_BORROWED_REFS 1
70  #undef CYTHON_ASSUME_SAFE_MACROS
71  #define CYTHON_ASSUME_SAFE_MACROS 0
72  #undef CYTHON_UNPACK_METHODS
73  #define CYTHON_UNPACK_METHODS 0
74  #undef CYTHON_FAST_THREAD_STATE
75  #define CYTHON_FAST_THREAD_STATE 0
76  #undef CYTHON_FAST_PYCALL
77  #define CYTHON_FAST_PYCALL 0
78  #undef CYTHON_PEP489_MULTI_PHASE_INIT
79  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
80  #undef CYTHON_USE_TP_FINALIZE
81  #define CYTHON_USE_TP_FINALIZE 0
82  #undef CYTHON_USE_DICT_VERSIONS
83  #define CYTHON_USE_DICT_VERSIONS 0
84  #undef CYTHON_USE_EXC_INFO_STACK
85  #define CYTHON_USE_EXC_INFO_STACK 0
86 #elif defined(PYSTON_VERSION)
87  #define CYTHON_COMPILING_IN_PYPY 0
88  #define CYTHON_COMPILING_IN_PYSTON 1
89  #define CYTHON_COMPILING_IN_CPYTHON 0
90  #ifndef CYTHON_USE_TYPE_SLOTS
91  #define CYTHON_USE_TYPE_SLOTS 1
92  #endif
93  #undef CYTHON_USE_PYTYPE_LOOKUP
94  #define CYTHON_USE_PYTYPE_LOOKUP 0
95  #undef CYTHON_USE_ASYNC_SLOTS
96  #define CYTHON_USE_ASYNC_SLOTS 0
97  #undef CYTHON_USE_PYLIST_INTERNALS
98  #define CYTHON_USE_PYLIST_INTERNALS 0
99  #ifndef CYTHON_USE_UNICODE_INTERNALS
100  #define CYTHON_USE_UNICODE_INTERNALS 1
101  #endif
102  #undef CYTHON_USE_UNICODE_WRITER
103  #define CYTHON_USE_UNICODE_WRITER 0
104  #undef CYTHON_USE_PYLONG_INTERNALS
105  #define CYTHON_USE_PYLONG_INTERNALS 0
106  #ifndef CYTHON_AVOID_BORROWED_REFS
107  #define CYTHON_AVOID_BORROWED_REFS 0
108  #endif
109  #ifndef CYTHON_ASSUME_SAFE_MACROS
110  #define CYTHON_ASSUME_SAFE_MACROS 1
111  #endif
112  #ifndef CYTHON_UNPACK_METHODS
113  #define CYTHON_UNPACK_METHODS 1
114  #endif
115  #undef CYTHON_FAST_THREAD_STATE
116  #define CYTHON_FAST_THREAD_STATE 0
117  #undef CYTHON_FAST_PYCALL
118  #define CYTHON_FAST_PYCALL 0
119  #undef CYTHON_PEP489_MULTI_PHASE_INIT
120  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
121  #undef CYTHON_USE_TP_FINALIZE
122  #define CYTHON_USE_TP_FINALIZE 0
123  #undef CYTHON_USE_DICT_VERSIONS
124  #define CYTHON_USE_DICT_VERSIONS 0
125  #undef CYTHON_USE_EXC_INFO_STACK
126  #define CYTHON_USE_EXC_INFO_STACK 0
127 #else
128  #define CYTHON_COMPILING_IN_PYPY 0
129  #define CYTHON_COMPILING_IN_PYSTON 0
130  #define CYTHON_COMPILING_IN_CPYTHON 1
131  #ifndef CYTHON_USE_TYPE_SLOTS
132  #define CYTHON_USE_TYPE_SLOTS 1
133  #endif
134  #if PY_VERSION_HEX < 0x02070000
135  #undef CYTHON_USE_PYTYPE_LOOKUP
136  #define CYTHON_USE_PYTYPE_LOOKUP 0
137  #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
138  #define CYTHON_USE_PYTYPE_LOOKUP 1
139  #endif
140  #if PY_MAJOR_VERSION < 3
141  #undef CYTHON_USE_ASYNC_SLOTS
142  #define CYTHON_USE_ASYNC_SLOTS 0
143  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
144  #define CYTHON_USE_ASYNC_SLOTS 1
145  #endif
146  #if PY_VERSION_HEX < 0x02070000
147  #undef CYTHON_USE_PYLONG_INTERNALS
148  #define CYTHON_USE_PYLONG_INTERNALS 0
149  #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
150  #define CYTHON_USE_PYLONG_INTERNALS 1
151  #endif
152  #ifndef CYTHON_USE_PYLIST_INTERNALS
153  #define CYTHON_USE_PYLIST_INTERNALS 1
154  #endif
155  #ifndef CYTHON_USE_UNICODE_INTERNALS
156  #define CYTHON_USE_UNICODE_INTERNALS 1
157  #endif
158  #if PY_VERSION_HEX < 0x030300F0
159  #undef CYTHON_USE_UNICODE_WRITER
160  #define CYTHON_USE_UNICODE_WRITER 0
161  #elif !defined(CYTHON_USE_UNICODE_WRITER)
162  #define CYTHON_USE_UNICODE_WRITER 1
163  #endif
164  #ifndef CYTHON_AVOID_BORROWED_REFS
165  #define CYTHON_AVOID_BORROWED_REFS 0
166  #endif
167  #ifndef CYTHON_ASSUME_SAFE_MACROS
168  #define CYTHON_ASSUME_SAFE_MACROS 1
169  #endif
170  #ifndef CYTHON_UNPACK_METHODS
171  #define CYTHON_UNPACK_METHODS 1
172  #endif
173  #ifndef CYTHON_FAST_THREAD_STATE
174  #define CYTHON_FAST_THREAD_STATE 1
175  #endif
176  #ifndef CYTHON_FAST_PYCALL
177  #define CYTHON_FAST_PYCALL 1
178  #endif
179  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
180  #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
181  #endif
182  #ifndef CYTHON_USE_TP_FINALIZE
183  #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
184  #endif
185  #ifndef CYTHON_USE_DICT_VERSIONS
186  #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
187  #endif
188  #ifndef CYTHON_USE_EXC_INFO_STACK
189  #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
190  #endif
191 #endif
192 #if !defined(CYTHON_FAST_PYCCALL)
193 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
194 #endif
195 #if CYTHON_USE_PYLONG_INTERNALS
196  #include "longintrepr.h"
197  #undef SHIFT
198  #undef BASE
199  #undef MASK
200  #ifdef SIZEOF_VOID_P
201  enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
202  #endif
203 #endif
204 #ifndef __has_attribute
205  #define __has_attribute(x) 0
206 #endif
207 #ifndef __has_cpp_attribute
208  #define __has_cpp_attribute(x) 0
209 #endif
210 #ifndef CYTHON_RESTRICT
211  #if defined(__GNUC__)
212  #define CYTHON_RESTRICT __restrict__
213  #elif defined(_MSC_VER) && _MSC_VER >= 1400
214  #define CYTHON_RESTRICT __restrict
215  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
216  #define CYTHON_RESTRICT restrict
217  #else
218  #define CYTHON_RESTRICT
219  #endif
220 #endif
221 #ifndef CYTHON_UNUSED
222 # if defined(__GNUC__)
223 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
224 # define CYTHON_UNUSED __attribute__ ((__unused__))
225 # else
226 # define CYTHON_UNUSED
227 # endif
228 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
229 # define CYTHON_UNUSED __attribute__ ((__unused__))
230 # else
231 # define CYTHON_UNUSED
232 # endif
233 #endif
234 #ifndef CYTHON_MAYBE_UNUSED_VAR
235 # if defined(__cplusplus)
236  template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
237 # else
238 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
239 # endif
240 #endif
241 #ifndef CYTHON_NCP_UNUSED
242 # if CYTHON_COMPILING_IN_CPYTHON
243 # define CYTHON_NCP_UNUSED
244 # else
245 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
246 # endif
247 #endif
248 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
249 #ifdef _MSC_VER
250  #ifndef _MSC_STDINT_H_
251  #if _MSC_VER < 1300
252  typedef unsigned char uint8_t;
253  typedef unsigned int uint32_t;
254  #else
255  typedef unsigned __int8 uint8_t;
256  typedef unsigned __int32 uint32_t;
257  #endif
258  #endif
259 #else
260  #include <stdint.h>
261 #endif
262 #ifndef CYTHON_FALLTHROUGH
263  #if defined(__cplusplus) && __cplusplus >= 201103L
264  #if __has_cpp_attribute(fallthrough)
265  #define CYTHON_FALLTHROUGH [[fallthrough]]
266  #elif __has_cpp_attribute(clang::fallthrough)
267  #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
268  #elif __has_cpp_attribute(gnu::fallthrough)
269  #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
270  #endif
271  #endif
272  #ifndef CYTHON_FALLTHROUGH
273  #if __has_attribute(fallthrough)
274  #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
275  #else
276  #define CYTHON_FALLTHROUGH
277  #endif
278  #endif
279  #if defined(__clang__ ) && defined(__apple_build_version__)
280  #if __apple_build_version__ < 7000000
281  #undef CYTHON_FALLTHROUGH
282  #define CYTHON_FALLTHROUGH
283  #endif
284  #endif
285 #endif
286 
287 #ifndef __cplusplus
288  #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
289 #endif
290 #ifndef CYTHON_INLINE
291  #if defined(__clang__)
292  #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
293  #else
294  #define CYTHON_INLINE inline
295  #endif
296 #endif
297 template<typename T>
298 void __Pyx_call_destructor(T& x) {
299  x.~T();
300 }
301 template<typename T>
302 class __Pyx_FakeReference {
303  public:
304  __Pyx_FakeReference() : ptr(NULL) { }
305  __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
306  T *operator->() { return ptr; }
307  T *operator&() { return ptr; }
308  operator T&() { return *ptr; }
309  template<typename U> bool operator ==(U other) { return *ptr == other; }
310  template<typename U> bool operator !=(U other) { return *ptr != other; }
311  private:
312  T *ptr;
313 };
314 
315 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
316  #define Py_OptimizeFlag 0
317 #endif
318 #define __PYX_BUILD_PY_SSIZE_T "n"
319 #define CYTHON_FORMAT_SSIZE_T "z"
320 #if PY_MAJOR_VERSION < 3
321  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
322  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
323  PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
324  #define __Pyx_DefaultClassType PyClass_Type
325 #else
326  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
327 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
328  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
329  PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
330 #else
331  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
332  PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
333 #endif
334  #define __Pyx_DefaultClassType PyType_Type
335 #endif
336 #ifndef Py_TPFLAGS_CHECKTYPES
337  #define Py_TPFLAGS_CHECKTYPES 0
338 #endif
339 #ifndef Py_TPFLAGS_HAVE_INDEX
340  #define Py_TPFLAGS_HAVE_INDEX 0
341 #endif
342 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
343  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
344 #endif
345 #ifndef Py_TPFLAGS_HAVE_FINALIZE
346  #define Py_TPFLAGS_HAVE_FINALIZE 0
347 #endif
348 #ifndef METH_STACKLESS
349  #define METH_STACKLESS 0
350 #endif
351 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
352  #ifndef METH_FASTCALL
353  #define METH_FASTCALL 0x80
354  #endif
355  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
356  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
357  Py_ssize_t nargs, PyObject *kwnames);
358 #else
359  #define __Pyx_PyCFunctionFast _PyCFunctionFast
360  #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
361 #endif
362 #if CYTHON_FAST_PYCCALL
363 #define __Pyx_PyFastCFunction_Check(func)\
364  ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
365 #else
366 #define __Pyx_PyFastCFunction_Check(func) 0
367 #endif
368 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
369  #define PyObject_Malloc(s) PyMem_Malloc(s)
370  #define PyObject_Free(p) PyMem_Free(p)
371  #define PyObject_Realloc(p) PyMem_Realloc(p)
372 #endif
373 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
374  #define PyMem_RawMalloc(n) PyMem_Malloc(n)
375  #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
376  #define PyMem_RawFree(p) PyMem_Free(p)
377 #endif
378 #if CYTHON_COMPILING_IN_PYSTON
379  #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
380  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
381 #else
382  #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
383  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
384 #endif
385 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
386  #define __Pyx_PyThreadState_Current PyThreadState_GET()
387 #elif PY_VERSION_HEX >= 0x03060000
388  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
389 #elif PY_VERSION_HEX >= 0x03000000
390  #define __Pyx_PyThreadState_Current PyThreadState_GET()
391 #else
392  #define __Pyx_PyThreadState_Current _PyThreadState_Current
393 #endif
394 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
395 #include "pythread.h"
396 #define Py_tss_NEEDS_INIT 0
397 typedef int Py_tss_t;
398 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
399  *key = PyThread_create_key();
400  return 0;
401 }
402 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
403  Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
404  *key = Py_tss_NEEDS_INIT;
405  return key;
406 }
407 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
408  PyObject_Free(key);
409 }
410 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
411  return *key != Py_tss_NEEDS_INIT;
412 }
413 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
414  PyThread_delete_key(*key);
415  *key = Py_tss_NEEDS_INIT;
416 }
417 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
418  return PyThread_set_key_value(*key, value);
419 }
420 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
421  return PyThread_get_key_value(*key);
422 }
423 #endif
424 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
425 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
426 #else
427 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
428 #endif
429 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
430  #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
431  #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
432 #else
433  #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
434  #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
435 #endif
436 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
437 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
438 #else
439 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
440 #endif
441 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
442  #define CYTHON_PEP393_ENABLED 1
443  #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
444  0 : _PyUnicode_Ready((PyObject *)(op)))
445  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
446  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
447  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
448  #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
449  #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
450  #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
451  #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
452  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
453 #else
454  #define CYTHON_PEP393_ENABLED 0
455  #define PyUnicode_1BYTE_KIND 1
456  #define PyUnicode_2BYTE_KIND 2
457  #define PyUnicode_4BYTE_KIND 4
458  #define __Pyx_PyUnicode_READY(op) (0)
459  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
460  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
461  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
462  #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
463  #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
464  #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
465  #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
466  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
467 #endif
468 #if CYTHON_COMPILING_IN_PYPY
469  #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
470  #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
471 #else
472  #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
473  #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
474  PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
475 #endif
476 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
477  #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
478 #endif
479 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
480  #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
481 #endif
482 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
483  #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
484 #endif
485 #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
486 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
487 #if PY_MAJOR_VERSION >= 3
488  #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
489 #else
490  #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
491 #endif
492 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
493  #define PyObject_ASCII(o) PyObject_Repr(o)
494 #endif
495 #if PY_MAJOR_VERSION >= 3
496  #define PyBaseString_Type PyUnicode_Type
497  #define PyStringObject PyUnicodeObject
498  #define PyString_Type PyUnicode_Type
499  #define PyString_Check PyUnicode_Check
500  #define PyString_CheckExact PyUnicode_CheckExact
501 #ifndef PyObject_Unicode
502  #define PyObject_Unicode PyObject_Str
503 #endif
504 #endif
505 #if PY_MAJOR_VERSION >= 3
506  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
507  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
508 #else
509  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
510  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
511 #endif
512 #ifndef PySet_CheckExact
513  #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
514 #endif
515 #if CYTHON_ASSUME_SAFE_MACROS
516  #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
517 #else
518  #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
519 #endif
520 #if PY_MAJOR_VERSION >= 3
521  #define PyIntObject PyLongObject
522  #define PyInt_Type PyLong_Type
523  #define PyInt_Check(op) PyLong_Check(op)
524  #define PyInt_CheckExact(op) PyLong_CheckExact(op)
525  #define PyInt_FromString PyLong_FromString
526  #define PyInt_FromUnicode PyLong_FromUnicode
527  #define PyInt_FromLong PyLong_FromLong
528  #define PyInt_FromSize_t PyLong_FromSize_t
529  #define PyInt_FromSsize_t PyLong_FromSsize_t
530  #define PyInt_AsLong PyLong_AsLong
531  #define PyInt_AS_LONG PyLong_AS_LONG
532  #define PyInt_AsSsize_t PyLong_AsSsize_t
533  #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
534  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
535  #define PyNumber_Int PyNumber_Long
536 #endif
537 #if PY_MAJOR_VERSION >= 3
538  #define PyBoolObject PyLongObject
539 #endif
540 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
541  #ifndef PyUnicode_InternFromString
542  #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
543  #endif
544 #endif
545 #if PY_VERSION_HEX < 0x030200A4
546  typedef long Py_hash_t;
547  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
548  #define __Pyx_PyInt_AsHash_t PyInt_AsLong
549 #else
550  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
551  #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
552 #endif
553 #if PY_MAJOR_VERSION >= 3
554  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
555 #else
556  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
557 #endif
558 #if CYTHON_USE_ASYNC_SLOTS
559  #if PY_VERSION_HEX >= 0x030500B1
560  #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
561  #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
562  #else
563  #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
564  #endif
565 #else
566  #define __Pyx_PyType_AsAsync(obj) NULL
567 #endif
568 #ifndef __Pyx_PyAsyncMethodsStruct
569  typedef struct {
570  unaryfunc am_await;
571  unaryfunc am_aiter;
572  unaryfunc am_anext;
573  } __Pyx_PyAsyncMethodsStruct;
574 #endif
575 
576 #if defined(WIN32) || defined(MS_WINDOWS)
577  #define _USE_MATH_DEFINES
578 #endif
579 #include <math.h>
580 #ifdef NAN
581 #define __PYX_NAN() ((float) NAN)
582 #else
583 static CYTHON_INLINE float __PYX_NAN() {
584  float value;
585  memset(&value, 0xFF, sizeof(value));
586  return value;
587 }
588 #endif
589 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
590 #define __Pyx_truncl trunc
591 #else
592 #define __Pyx_truncl truncl
593 #endif
594 
595 
596 #define __PYX_ERR(f_index, lineno, Ln_error) \
597 { \
598  __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
599 }
600 
601 #ifndef __PYX_EXTERN_C
602  #ifdef __cplusplus
603  #define __PYX_EXTERN_C extern "C"
604  #else
605  #define __PYX_EXTERN_C extern
606  #endif
607 #endif
608 
609 #define __PYX_HAVE__mprans__MeshSmoothing
610 #define __PYX_HAVE_API__mprans__MeshSmoothing
611 /* Early includes */
612 #include <string.h>
613 #include <stdio.h>
614 #include "numpy/arrayobject.h"
615 #include "numpy/ufuncobject.h"
616 #include <math.h>
617 #include "pythread.h"
618 #include <stdlib.h>
619 #include "pystate.h"
620 #ifdef _OPENMP
621 #include <omp.h>
622 #endif /* _OPENMP */
623 
624 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
625 #define CYTHON_WITHOUT_ASSERTIONS
626 #endif
627 
628 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
629  const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
630 
631 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
632 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
633 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
634 #define __PYX_DEFAULT_STRING_ENCODING ""
635 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
636 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
637 #define __Pyx_uchar_cast(c) ((unsigned char)c)
638 #define __Pyx_long_cast(x) ((long)x)
639 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
640  (sizeof(type) < sizeof(Py_ssize_t)) ||\
641  (sizeof(type) > sizeof(Py_ssize_t) &&\
642  likely(v < (type)PY_SSIZE_T_MAX ||\
643  v == (type)PY_SSIZE_T_MAX) &&\
644  (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
645  v == (type)PY_SSIZE_T_MIN))) ||\
646  (sizeof(type) == sizeof(Py_ssize_t) &&\
647  (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
648  v == (type)PY_SSIZE_T_MAX))) )
649 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
650  return (size_t) i < (size_t) limit;
651 }
652 #if defined (__cplusplus) && __cplusplus >= 201103L
653  #include <cstdlib>
654  #define __Pyx_sst_abs(value) std::abs(value)
655 #elif SIZEOF_INT >= SIZEOF_SIZE_T
656  #define __Pyx_sst_abs(value) abs(value)
657 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
658  #define __Pyx_sst_abs(value) labs(value)
659 #elif defined (_MSC_VER)
660  #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
661 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
662  #define __Pyx_sst_abs(value) llabs(value)
663 #elif defined (__GNUC__)
664  #define __Pyx_sst_abs(value) __builtin_llabs(value)
665 #else
666  #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
667 #endif
668 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
669 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
670 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
671 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
672 #define __Pyx_PyBytes_FromString PyBytes_FromString
673 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
674 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
675 #if PY_MAJOR_VERSION < 3
676  #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
677  #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
678 #else
679  #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
680  #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
681 #endif
682 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
683 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
684 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
685 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
686 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
687 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
688 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
689 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
690 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
691 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
692 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
693 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
694 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
695 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
696 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
697 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
698 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
699  const Py_UNICODE *u_end = u;
700  while (*u_end++) ;
701  return (size_t)(u_end - u - 1);
702 }
703 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
704 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
705 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
706 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
707 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
708 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
709 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
710 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
711 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
712 #define __Pyx_PySequence_Tuple(obj)\
713  (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
714 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
715 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
716 #if CYTHON_ASSUME_SAFE_MACROS
717 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
718 #else
719 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
720 #endif
721 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
722 #if PY_MAJOR_VERSION >= 3
723 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
724 #else
725 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
726 #endif
727 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
728 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
729 static int __Pyx_sys_getdefaultencoding_not_ascii;
730 static int __Pyx_init_sys_getdefaultencoding_params(void) {
731  PyObject* sys;
732  PyObject* default_encoding = NULL;
733  PyObject* ascii_chars_u = NULL;
734  PyObject* ascii_chars_b = NULL;
735  const char* default_encoding_c;
736  sys = PyImport_ImportModule("sys");
737  if (!sys) goto bad;
738  default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
739  Py_DECREF(sys);
740  if (!default_encoding) goto bad;
741  default_encoding_c = PyBytes_AsString(default_encoding);
742  if (!default_encoding_c) goto bad;
743  if (strcmp(default_encoding_c, "ascii") == 0) {
744  __Pyx_sys_getdefaultencoding_not_ascii = 0;
745  } else {
746  char ascii_chars[128];
747  int c;
748  for (c = 0; c < 128; c++) {
749  ascii_chars[c] = c;
750  }
751  __Pyx_sys_getdefaultencoding_not_ascii = 1;
752  ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
753  if (!ascii_chars_u) goto bad;
754  ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
755  if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
756  PyErr_Format(
757  PyExc_ValueError,
758  "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
759  default_encoding_c);
760  goto bad;
761  }
762  Py_DECREF(ascii_chars_u);
763  Py_DECREF(ascii_chars_b);
764  }
765  Py_DECREF(default_encoding);
766  return 0;
767 bad:
768  Py_XDECREF(default_encoding);
769  Py_XDECREF(ascii_chars_u);
770  Py_XDECREF(ascii_chars_b);
771  return -1;
772 }
773 #endif
774 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
775 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
776 #else
777 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
778 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
779 static char* __PYX_DEFAULT_STRING_ENCODING;
780 static int __Pyx_init_sys_getdefaultencoding_params(void) {
781  PyObject* sys;
782  PyObject* default_encoding = NULL;
783  char* default_encoding_c;
784  sys = PyImport_ImportModule("sys");
785  if (!sys) goto bad;
786  default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
787  Py_DECREF(sys);
788  if (!default_encoding) goto bad;
789  default_encoding_c = PyBytes_AsString(default_encoding);
790  if (!default_encoding_c) goto bad;
791  __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
792  if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
793  strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
794  Py_DECREF(default_encoding);
795  return 0;
796 bad:
797  Py_XDECREF(default_encoding);
798  return -1;
799 }
800 #endif
801 #endif
802 
803 
804 /* Test for GCC > 2.95 */
805 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
806  #define likely(x) __builtin_expect(!!(x), 1)
807  #define unlikely(x) __builtin_expect(!!(x), 0)
808 #else /* !__GNUC__ or GCC < 2.95 */
809  #define likely(x) (x)
810  #define unlikely(x) (x)
811 #endif /* __GNUC__ */
812 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
813 
814 static PyObject *__pyx_m = NULL;
815 static PyObject *__pyx_d;
816 static PyObject *__pyx_b;
817 static PyObject *__pyx_cython_runtime = NULL;
818 static PyObject *__pyx_empty_tuple;
819 static PyObject *__pyx_empty_bytes;
820 static PyObject *__pyx_empty_unicode;
821 static int __pyx_lineno;
822 static int __pyx_clineno = 0;
823 static const char * __pyx_cfilenm= __FILE__;
824 static const char *__pyx_filename;
825 
826 /* Header.proto */
827 #if !defined(CYTHON_CCOMPLEX)
828  #if defined(__cplusplus)
829  #define CYTHON_CCOMPLEX 1
830  #elif defined(_Complex_I)
831  #define CYTHON_CCOMPLEX 1
832  #else
833  #define CYTHON_CCOMPLEX 0
834  #endif
835 #endif
836 #if CYTHON_CCOMPLEX
837  #ifdef __cplusplus
838  #include <complex>
839  #else
840  #include <complex.h>
841  #endif
842 #endif
843 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
844  #undef _Complex_I
845  #define _Complex_I 1.0fj
846 #endif
847 
848 
849 static const char *__pyx_f[] = {
850  "proteus/mprans/MeshSmoothing.pyx",
851  "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd",
852  "stringsource",
853  "linux/lib/python3.7/site-packages/Cython/Includes/cpython/type.pxd",
854 };
855 /* MemviewSliceStruct.proto */
856 struct __pyx_memoryview_obj;
857 typedef struct {
858  struct __pyx_memoryview_obj *memview;
859  char *data;
860  Py_ssize_t shape[8];
861  Py_ssize_t strides[8];
862  Py_ssize_t suboffsets[8];
863 } __Pyx_memviewslice;
864 #define __Pyx_MemoryView_Len(m) (m.shape[0])
865 
866 /* Atomics.proto */
867 #include <pythread.h>
868 #ifndef CYTHON_ATOMICS
869  #define CYTHON_ATOMICS 1
870 #endif
871 #define __pyx_atomic_int_type int
872 #if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||\
873  (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) &&\
874  !defined(__i386__)
875  #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
876  #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
877  #ifdef __PYX_DEBUG_ATOMICS
878  #warning "Using GNU atomics"
879  #endif
880 #elif CYTHON_ATOMICS && defined(_MSC_VER) && 0
881  #include <Windows.h>
882  #undef __pyx_atomic_int_type
883  #define __pyx_atomic_int_type LONG
884  #define __pyx_atomic_incr_aligned(value, lock) InterlockedIncrement(value)
885  #define __pyx_atomic_decr_aligned(value, lock) InterlockedDecrement(value)
886  #ifdef __PYX_DEBUG_ATOMICS
887  #pragma message ("Using MSVC atomics")
888  #endif
889 #elif CYTHON_ATOMICS && (defined(__ICC) || defined(__INTEL_COMPILER)) && 0
890  #define __pyx_atomic_incr_aligned(value, lock) _InterlockedIncrement(value)
891  #define __pyx_atomic_decr_aligned(value, lock) _InterlockedDecrement(value)
892  #ifdef __PYX_DEBUG_ATOMICS
893  #warning "Using Intel atomics"
894  #endif
895 #else
896  #undef CYTHON_ATOMICS
897  #define CYTHON_ATOMICS 0
898  #ifdef __PYX_DEBUG_ATOMICS
899  #warning "Not using atomics"
900  #endif
901 #endif
902 typedef volatile __pyx_atomic_int_type __pyx_atomic_int;
903 #if CYTHON_ATOMICS
904  #define __pyx_add_acquisition_count(memview)\
905  __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
906  #define __pyx_sub_acquisition_count(memview)\
907  __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
908 #else
909  #define __pyx_add_acquisition_count(memview)\
910  __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
911  #define __pyx_sub_acquisition_count(memview)\
912  __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
913 #endif
914 
915 /* ForceInitThreads.proto */
916 #ifndef __PYX_FORCE_INIT_THREADS
917  #define __PYX_FORCE_INIT_THREADS 0
918 #endif
919 
920 /* NoFastGil.proto */
921 #define __Pyx_PyGILState_Ensure PyGILState_Ensure
922 #define __Pyx_PyGILState_Release PyGILState_Release
923 #define __Pyx_FastGIL_Remember()
924 #define __Pyx_FastGIL_Forget()
925 #define __Pyx_FastGilFuncInit()
926 
927 /* BufferFormatStructs.proto */
928 #define IS_UNSIGNED(type) (((type) -1) > 0)
929 struct __Pyx_StructField_;
930 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
931 typedef struct {
932  const char* name;
933  struct __Pyx_StructField_* fields;
934  size_t size;
935  size_t arraysize[8];
936  int ndim;
937  char typegroup;
938  char is_unsigned;
939  int flags;
940 } __Pyx_TypeInfo;
941 typedef struct __Pyx_StructField_ {
942  __Pyx_TypeInfo* type;
943  const char* name;
944  size_t offset;
945 } __Pyx_StructField;
946 typedef struct {
947  __Pyx_StructField* field;
948  size_t parent_offset;
949 } __Pyx_BufFmt_StackElem;
950 typedef struct {
951  __Pyx_StructField root;
952  __Pyx_BufFmt_StackElem* head;
953  size_t fmt_offset;
954  size_t new_count, enc_count;
955  size_t struct_alignment;
956  int is_complex;
957  char enc_type;
958  char new_packmode;
959  char enc_packmode;
960  char is_valid_array;
961 } __Pyx_BufFmt_Context;
962 
963 
964 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":776
965  * # in Cython to enable them only on the right systems.
966  *
967  * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<<
968  * ctypedef npy_int16 int16_t
969  * ctypedef npy_int32 int32_t
970  */
971 typedef npy_int8 __pyx_t_5numpy_int8_t;
972 
973 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":777
974  *
975  * ctypedef npy_int8 int8_t
976  * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<<
977  * ctypedef npy_int32 int32_t
978  * ctypedef npy_int64 int64_t
979  */
980 typedef npy_int16 __pyx_t_5numpy_int16_t;
981 
982 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":778
983  * ctypedef npy_int8 int8_t
984  * ctypedef npy_int16 int16_t
985  * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<<
986  * ctypedef npy_int64 int64_t
987  * #ctypedef npy_int96 int96_t
988  */
989 typedef npy_int32 __pyx_t_5numpy_int32_t;
990 
991 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":779
992  * ctypedef npy_int16 int16_t
993  * ctypedef npy_int32 int32_t
994  * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<<
995  * #ctypedef npy_int96 int96_t
996  * #ctypedef npy_int128 int128_t
997  */
998 typedef npy_int64 __pyx_t_5numpy_int64_t;
999 
1000 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":783
1001  * #ctypedef npy_int128 int128_t
1002  *
1003  * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<<
1004  * ctypedef npy_uint16 uint16_t
1005  * ctypedef npy_uint32 uint32_t
1006  */
1007 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
1008 
1009 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":784
1010  *
1011  * ctypedef npy_uint8 uint8_t
1012  * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<<
1013  * ctypedef npy_uint32 uint32_t
1014  * ctypedef npy_uint64 uint64_t
1015  */
1016 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
1017 
1018 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":785
1019  * ctypedef npy_uint8 uint8_t
1020  * ctypedef npy_uint16 uint16_t
1021  * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<<
1022  * ctypedef npy_uint64 uint64_t
1023  * #ctypedef npy_uint96 uint96_t
1024  */
1025 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
1026 
1027 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":786
1028  * ctypedef npy_uint16 uint16_t
1029  * ctypedef npy_uint32 uint32_t
1030  * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<<
1031  * #ctypedef npy_uint96 uint96_t
1032  * #ctypedef npy_uint128 uint128_t
1033  */
1034 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
1035 
1036 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":790
1037  * #ctypedef npy_uint128 uint128_t
1038  *
1039  * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<<
1040  * ctypedef npy_float64 float64_t
1041  * #ctypedef npy_float80 float80_t
1042  */
1043 typedef npy_float32 __pyx_t_5numpy_float32_t;
1044 
1045 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":791
1046  *
1047  * ctypedef npy_float32 float32_t
1048  * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<<
1049  * #ctypedef npy_float80 float80_t
1050  * #ctypedef npy_float128 float128_t
1051  */
1052 typedef npy_float64 __pyx_t_5numpy_float64_t;
1053 
1054 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":800
1055  * # The int types are mapped a bit surprising --
1056  * # numpy.int corresponds to 'l' and numpy.long to 'q'
1057  * ctypedef npy_long int_t # <<<<<<<<<<<<<<
1058  * ctypedef npy_longlong long_t
1059  * ctypedef npy_longlong longlong_t
1060  */
1061 typedef npy_long __pyx_t_5numpy_int_t;
1062 
1063 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":801
1064  * # numpy.int corresponds to 'l' and numpy.long to 'q'
1065  * ctypedef npy_long int_t
1066  * ctypedef npy_longlong long_t # <<<<<<<<<<<<<<
1067  * ctypedef npy_longlong longlong_t
1068  *
1069  */
1070 typedef npy_longlong __pyx_t_5numpy_long_t;
1071 
1072 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":802
1073  * ctypedef npy_long int_t
1074  * ctypedef npy_longlong long_t
1075  * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<<
1076  *
1077  * ctypedef npy_ulong uint_t
1078  */
1079 typedef npy_longlong __pyx_t_5numpy_longlong_t;
1080 
1081 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":804
1082  * ctypedef npy_longlong longlong_t
1083  *
1084  * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<<
1085  * ctypedef npy_ulonglong ulong_t
1086  * ctypedef npy_ulonglong ulonglong_t
1087  */
1088 typedef npy_ulong __pyx_t_5numpy_uint_t;
1089 
1090 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":805
1091  *
1092  * ctypedef npy_ulong uint_t
1093  * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<<
1094  * ctypedef npy_ulonglong ulonglong_t
1095  *
1096  */
1097 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1098 
1099 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":806
1100  * ctypedef npy_ulong uint_t
1101  * ctypedef npy_ulonglong ulong_t
1102  * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<<
1103  *
1104  * ctypedef npy_intp intp_t
1105  */
1106 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1107 
1108 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":808
1109  * ctypedef npy_ulonglong ulonglong_t
1110  *
1111  * ctypedef npy_intp intp_t # <<<<<<<<<<<<<<
1112  * ctypedef npy_uintp uintp_t
1113  *
1114  */
1115 typedef npy_intp __pyx_t_5numpy_intp_t;
1116 
1117 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":809
1118  *
1119  * ctypedef npy_intp intp_t
1120  * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<<
1121  *
1122  * ctypedef npy_double float_t
1123  */
1124 typedef npy_uintp __pyx_t_5numpy_uintp_t;
1125 
1126 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":811
1127  * ctypedef npy_uintp uintp_t
1128  *
1129  * ctypedef npy_double float_t # <<<<<<<<<<<<<<
1130  * ctypedef npy_double double_t
1131  * ctypedef npy_longdouble longdouble_t
1132  */
1133 typedef npy_double __pyx_t_5numpy_float_t;
1134 
1135 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":812
1136  *
1137  * ctypedef npy_double float_t
1138  * ctypedef npy_double double_t # <<<<<<<<<<<<<<
1139  * ctypedef npy_longdouble longdouble_t
1140  *
1141  */
1142 typedef npy_double __pyx_t_5numpy_double_t;
1143 
1144 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":813
1145  * ctypedef npy_double float_t
1146  * ctypedef npy_double double_t
1147  * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<<
1148  *
1149  * ctypedef npy_cfloat cfloat_t
1150  */
1151 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1152 /* Declarations.proto */
1153 #if CYTHON_CCOMPLEX
1154  #ifdef __cplusplus
1155  typedef ::std::complex< float > __pyx_t_float_complex;
1156  #else
1157  typedef float _Complex __pyx_t_float_complex;
1158  #endif
1159 #else
1160  typedef struct { float real, imag; } __pyx_t_float_complex;
1161 #endif
1162 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
1163 
1164 /* Declarations.proto */
1165 #if CYTHON_CCOMPLEX
1166  #ifdef __cplusplus
1167  typedef ::std::complex< double > __pyx_t_double_complex;
1168  #else
1169  typedef double _Complex __pyx_t_double_complex;
1170  #endif
1171 #else
1172  typedef struct { double real, imag; } __pyx_t_double_complex;
1173 #endif
1174 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
1175 
1176 
1177 /*--- Type declarations ---*/
1178 struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues;
1179 struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr;
1180 struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr;
1181 struct __pyx_array_obj;
1182 struct __pyx_MemviewEnum_obj;
1183 struct __pyx_memoryview_obj;
1184 struct __pyx_memoryviewslice_obj;
1185 
1186 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":815
1187  * ctypedef npy_longdouble longdouble_t
1188  *
1189  * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<<
1190  * ctypedef npy_cdouble cdouble_t
1191  * ctypedef npy_clongdouble clongdouble_t
1192  */
1193 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1194 
1195 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":816
1196  *
1197  * ctypedef npy_cfloat cfloat_t
1198  * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<<
1199  * ctypedef npy_clongdouble clongdouble_t
1200  *
1201  */
1202 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1203 
1204 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":817
1205  * ctypedef npy_cfloat cfloat_t
1206  * ctypedef npy_cdouble cdouble_t
1207  * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<<
1208  *
1209  * ctypedef npy_cdouble complex_t
1210  */
1211 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1212 
1213 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":819
1214  * ctypedef npy_clongdouble clongdouble_t
1215  *
1216  * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<<
1217  *
1218  * cdef inline object PyArray_MultiIterNew1(a):
1219  */
1220 typedef npy_cdouble __pyx_t_5numpy_complex_t;
1221 struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesLaplace;
1222 struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesCentroid;
1223 struct __pyx_opt_args_6mprans_13MeshSmoothing_cyUpdateInverseMeanRatioTriangleNodes;
1224 struct __pyx_opt_args_6mprans_13MeshSmoothing_cyGetInverseMeanRatioSingleTriangle;
1225 struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesQuality;
1226 
1227 /* "mprans/MeshSmoothing.pxd":6
1228  * from libcpp cimport bool
1229  *
1230  * cdef void cySmoothNodesLaplace(double[:,:] nodeArray_, # <<<<<<<<<<<<<<
1231  * int[:] nodeStarOffsets,
1232  * int[:] nodeStarArray,
1233  */
1234 struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesLaplace {
1235  int __pyx_n;
1236  bool simultaneous;
1237  bool smoothBoundaries;
1238  __Pyx_memviewslice fixedNodesBoolArray;
1239  double alpha;
1240 };
1241 
1242 /* "mprans/MeshSmoothing.pxd":17
1243  * double alpha=*)
1244  *
1245  * cdef void cySmoothNodesCentroid(double[:,:] nodeArray_, # <<<<<<<<<<<<<<
1246  * int[:] nodeElementOffsets,
1247  * int[:] nodeElementsArray,
1248  */
1249 struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesCentroid {
1250  int __pyx_n;
1251  bool simultaneous;
1252  bool smoothBoundaries;
1253  double alpha;
1254 };
1255 
1256 /* "mprans/MeshSmoothing.pxd":41
1257  * int nElements)
1258  *
1259  * cdef void cyUpdateInverseMeanRatioTriangleNodes(double[:] IMRNodesArray_, # <<<<<<<<<<<<<<
1260  * double[:,:] nodeArray,
1261  * int[:,:] elementNodesArray,
1262  */
1263 struct __pyx_opt_args_6mprans_13MeshSmoothing_cyUpdateInverseMeanRatioTriangleNodes {
1264  int __pyx_n;
1265  bool el_average;
1266 };
1267 
1268 /* "mprans/MeshSmoothing.pxd":55
1269  * int nElements)
1270  *
1271  * cdef double cyGetInverseMeanRatioSingleTriangle(int node0, # <<<<<<<<<<<<<<
1272  * double[:,:] nodeArray,
1273  * int[:,:] elementNodesArray,
1274  */
1275 struct __pyx_opt_args_6mprans_13MeshSmoothing_cyGetInverseMeanRatioSingleTriangle {
1276  int __pyx_n;
1277  bool el_average;
1278 };
1279 
1280 /* "mprans/MeshSmoothing.pxd":62
1281  * bool el_average=*)
1282  *
1283  * cdef double[:,:] cySmoothNodesQuality(double[:] distortion, # <<<<<<<<<<<<<<
1284  * double[:] dilation,
1285  * double[:,:] nodeArray,
1286  */
1287 struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesQuality {
1288  int __pyx_n;
1289  bool apply_directly;
1290 };
1291 
1292 /* "mprans/MeshSmoothing.pyx":559
1293  * nNodes=nNodes)
1294  *
1295  * def getNonOwnedNodeValues(args_, # <<<<<<<<<<<<<<
1296  * int nNodes_owned,
1297  * int nNodes_global,
1298  */
1299 struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues {
1300  PyObject_HEAD
1301  int __pyx_v_comm_size;
1302 };
1303 
1304 
1305 /* "mprans/MeshSmoothing.pyx":625
1306  * comm.Gatherv(my_size,
1307  * [counts_in,
1308  * tuple(1 for i in range(comm_size)), # <<<<<<<<<<<<<<
1309  * tuple(i for i in range(comm_size)),
1310  * MPI.INT],
1311  */
1312 struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr {
1313  PyObject_HEAD
1314  struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues *__pyx_outer_scope;
1315  int __pyx_v_i;
1316  int __pyx_t_0;
1317  int __pyx_t_1;
1318  int __pyx_t_2;
1319 };
1320 
1321 
1322 /* "mprans/MeshSmoothing.pyx":626
1323  * [counts_in,
1324  * tuple(1 for i in range(comm_size)),
1325  * tuple(i for i in range(comm_size)), # <<<<<<<<<<<<<<
1326  * MPI.INT],
1327  * root=rank_recv
1328  */
1329 struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr {
1330  PyObject_HEAD
1331  struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues *__pyx_outer_scope;
1332  int __pyx_v_i;
1333  int __pyx_t_0;
1334  int __pyx_t_1;
1335  int __pyx_t_2;
1336 };
1337 
1338 
1339 /* "View.MemoryView":105
1340  *
1341  * @cname("__pyx_array")
1342  * cdef class array: # <<<<<<<<<<<<<<
1343  *
1344  * cdef:
1345  */
1346 struct __pyx_array_obj {
1347  PyObject_HEAD
1348  struct __pyx_vtabstruct_array *__pyx_vtab;
1349  char *data;
1350  Py_ssize_t len;
1351  char *format;
1352  int ndim;
1353  Py_ssize_t *_shape;
1354  Py_ssize_t *_strides;
1355  Py_ssize_t itemsize;
1356  PyObject *mode;
1357  PyObject *_format;
1358  void (*callback_free_data)(void *);
1359  int free_data;
1360  int dtype_is_object;
1361 };
1362 
1363 
1364 /* "View.MemoryView":279
1365  *
1366  * @cname('__pyx_MemviewEnum')
1367  * cdef class Enum(object): # <<<<<<<<<<<<<<
1368  * cdef object name
1369  * def __init__(self, name):
1370  */
1371 struct __pyx_MemviewEnum_obj {
1372  PyObject_HEAD
1373  PyObject *name;
1374 };
1375 
1376 
1377 /* "View.MemoryView":330
1378  *
1379  * @cname('__pyx_memoryview')
1380  * cdef class memoryview(object): # <<<<<<<<<<<<<<
1381  *
1382  * cdef object obj
1383  */
1384 struct __pyx_memoryview_obj {
1385  PyObject_HEAD
1386  struct __pyx_vtabstruct_memoryview *__pyx_vtab;
1387  PyObject *obj;
1388  PyObject *_size;
1389  PyObject *_array_interface;
1390  PyThread_type_lock lock;
1391  __pyx_atomic_int acquisition_count[2];
1392  __pyx_atomic_int *acquisition_count_aligned_p;
1393  Py_buffer view;
1394  int flags;
1395  int dtype_is_object;
1396  __Pyx_TypeInfo *typeinfo;
1397 };
1398 
1399 
1400 /* "View.MemoryView":965
1401  *
1402  * @cname('__pyx_memoryviewslice')
1403  * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<<
1404  * "Internal class for passing memoryview slices to Python"
1405  *
1406  */
1407 struct __pyx_memoryviewslice_obj {
1408  struct __pyx_memoryview_obj __pyx_base;
1409  __Pyx_memviewslice from_slice;
1410  PyObject *from_object;
1411  PyObject *(*to_object_func)(char *);
1412  int (*to_dtype_func)(char *, PyObject *);
1413 };
1414 
1415 
1416 
1417 /* "View.MemoryView":105
1418  *
1419  * @cname("__pyx_array")
1420  * cdef class array: # <<<<<<<<<<<<<<
1421  *
1422  * cdef:
1423  */
1424 
1425 struct __pyx_vtabstruct_array {
1426  PyObject *(*get_memview)(struct __pyx_array_obj *);
1427 };
1428 static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;
1429 
1430 
1431 /* "View.MemoryView":330
1432  *
1433  * @cname('__pyx_memoryview')
1434  * cdef class memoryview(object): # <<<<<<<<<<<<<<
1435  *
1436  * cdef object obj
1437  */
1438 
1439 struct __pyx_vtabstruct_memoryview {
1440  char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *);
1441  PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *);
1442  PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1443  PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *);
1444  PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1445  PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *);
1446  PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *);
1447 };
1448 static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;
1449 
1450 
1451 /* "View.MemoryView":965
1452  *
1453  * @cname('__pyx_memoryviewslice')
1454  * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<<
1455  * "Internal class for passing memoryview slices to Python"
1456  *
1457  */
1458 
1459 struct __pyx_vtabstruct__memoryviewslice {
1460  struct __pyx_vtabstruct_memoryview __pyx_base;
1461 };
1462 static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
1463 
1464 /* --- Runtime support code (head) --- */
1465 /* Refnanny.proto */
1466 #ifndef CYTHON_REFNANNY
1467  #define CYTHON_REFNANNY 0
1468 #endif
1469 #if CYTHON_REFNANNY
1470  typedef struct {
1471  void (*INCREF)(void*, PyObject*, int);
1472  void (*DECREF)(void*, PyObject*, int);
1473  void (*GOTREF)(void*, PyObject*, int);
1474  void (*GIVEREF)(void*, PyObject*, int);
1475  void* (*SetupContext)(const char*, int, const char*);
1476  void (*FinishContext)(void**);
1477  } __Pyx_RefNannyAPIStruct;
1478  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1479  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1480  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1481 #ifdef WITH_THREAD
1482  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1483  if (acquire_gil) {\
1484  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1485  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1486  PyGILState_Release(__pyx_gilstate_save);\
1487  } else {\
1488  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1489  }
1490 #else
1491  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1492  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1493 #endif
1494  #define __Pyx_RefNannyFinishContext()\
1495  __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1496  #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1497  #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1498  #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1499  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1500  #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1501  #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1502  #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1503  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1504 #else
1505  #define __Pyx_RefNannyDeclarations
1506  #define __Pyx_RefNannySetupContext(name, acquire_gil)
1507  #define __Pyx_RefNannyFinishContext()
1508  #define __Pyx_INCREF(r) Py_INCREF(r)
1509  #define __Pyx_DECREF(r) Py_DECREF(r)
1510  #define __Pyx_GOTREF(r)
1511  #define __Pyx_GIVEREF(r)
1512  #define __Pyx_XINCREF(r) Py_XINCREF(r)
1513  #define __Pyx_XDECREF(r) Py_XDECREF(r)
1514  #define __Pyx_XGOTREF(r)
1515  #define __Pyx_XGIVEREF(r)
1516 #endif
1517 #define __Pyx_XDECREF_SET(r, v) do {\
1518  PyObject *tmp = (PyObject *) r;\
1519  r = v; __Pyx_XDECREF(tmp);\
1520  } while (0)
1521 #define __Pyx_DECREF_SET(r, v) do {\
1522  PyObject *tmp = (PyObject *) r;\
1523  r = v; __Pyx_DECREF(tmp);\
1524  } while (0)
1525 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1526 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1527 
1528 /* PyObjectGetAttrStr.proto */
1529 #if CYTHON_USE_TYPE_SLOTS
1530 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1531 #else
1532 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1533 #endif
1534 
1535 /* GetBuiltinName.proto */
1536 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1537 
1538 /* RaiseArgTupleInvalid.proto */
1539 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1540  Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1541 
1542 /* RaiseDoubleKeywords.proto */
1543 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1544 
1545 /* ParseKeywords.proto */
1546 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1547  PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1548  const char* function_name);
1549 
1550 /* MemviewSliceInit.proto */
1551 #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
1552 #define __Pyx_MEMVIEW_DIRECT 1
1553 #define __Pyx_MEMVIEW_PTR 2
1554 #define __Pyx_MEMVIEW_FULL 4
1555 #define __Pyx_MEMVIEW_CONTIG 8
1556 #define __Pyx_MEMVIEW_STRIDED 16
1557 #define __Pyx_MEMVIEW_FOLLOW 32
1558 #define __Pyx_IS_C_CONTIG 1
1559 #define __Pyx_IS_F_CONTIG 2
1560 static int __Pyx_init_memviewslice(
1561  struct __pyx_memoryview_obj *memview,
1562  int ndim,
1563  __Pyx_memviewslice *memviewslice,
1564  int memview_is_new_reference);
1565 static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
1566  __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1567 static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
1568  __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1569 #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
1570 #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
1571 #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
1572 #define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__)
1573 static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int);
1574 static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int);
1575 
1576 /* PyDictVersioning.proto */
1577 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1578 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1579 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1580 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1581  (version_var) = __PYX_GET_DICT_VERSION(dict);\
1582  (cache_var) = (value);
1583 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1584  static PY_UINT64_T __pyx_dict_version = 0;\
1585  static PyObject *__pyx_dict_cached_value = NULL;\
1586  if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1587  (VAR) = __pyx_dict_cached_value;\
1588  } else {\
1589  (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1590  __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1591  }\
1592 }
1593 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1594 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1595 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1596 #else
1597 #define __PYX_GET_DICT_VERSION(dict) (0)
1598 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1599 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1600 #endif
1601 
1602 /* GetModuleGlobalName.proto */
1603 #if CYTHON_USE_DICT_VERSIONS
1604 #define __Pyx_GetModuleGlobalName(var, name) {\
1605  static PY_UINT64_T __pyx_dict_version = 0;\
1606  static PyObject *__pyx_dict_cached_value = NULL;\
1607  (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1608  (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1609  __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1610 }
1611 #define __Pyx_GetModuleGlobalNameUncached(var, name) {\
1612  PY_UINT64_T __pyx_dict_version;\
1613  PyObject *__pyx_dict_cached_value;\
1614  (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1615 }
1616 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1617 #else
1618 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1619 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1620 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1621 #endif
1622 
1623 /* PyCFunctionFastCall.proto */
1624 #if CYTHON_FAST_PYCCALL
1625 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1626 #else
1627 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1628 #endif
1629 
1630 /* PyFunctionFastCall.proto */
1631 #if CYTHON_FAST_PYCALL
1632 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1633  __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1634 #if 1 || PY_VERSION_HEX < 0x030600B1
1635 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1636 #else
1637 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1638 #endif
1639 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1640  (sizeof(char [1 - 2*!(cond)]) - 1)
1641 #ifndef Py_MEMBER_SIZE
1642 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1643 #endif
1644  static size_t __pyx_pyframe_localsplus_offset = 0;
1645  #include "frameobject.h"
1646  #define __Pxy_PyFrame_Initialize_Offsets()\
1647  ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1648  (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1649  #define __Pyx_PyFrame_GetLocalsplus(frame)\
1650  (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1651 #endif
1652 
1653 /* PyObjectCall.proto */
1654 #if CYTHON_COMPILING_IN_CPYTHON
1655 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1656 #else
1657 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1658 #endif
1659 
1660 /* PyObjectCall2Args.proto */
1661 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1662 
1663 /* PyObjectCallMethO.proto */
1664 #if CYTHON_COMPILING_IN_CPYTHON
1665 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1666 #endif
1667 
1668 /* PyObjectCallOneArg.proto */
1669 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1670 
1671 /* PyIntBinop.proto */
1672 #if !CYTHON_COMPILING_IN_PYPY
1673 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
1674 #else
1675 #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
1676  (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
1677 #endif
1678 
1679 /* GetItemInt.proto */
1680 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1681  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1682  __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1683  (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1684  __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1685 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1686  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1687  __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1688  (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1689 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1690  int wraparound, int boundscheck);
1691 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1692  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1693  __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1694  (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1695 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1696  int wraparound, int boundscheck);
1697 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1698 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1699  int is_list, int wraparound, int boundscheck);
1700 
1701 /* ObjectGetItem.proto */
1702 #if CYTHON_USE_TYPE_SLOTS
1703 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1704 #else
1705 #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
1706 #endif
1707 
1708 /* ListAppend.proto */
1709 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1710 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1711  PyListObject* L = (PyListObject*) list;
1712  Py_ssize_t len = Py_SIZE(list);
1713  if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
1714  Py_INCREF(x);
1715  PyList_SET_ITEM(list, len, x);
1716  Py_SIZE(list) = len+1;
1717  return 0;
1718  }
1719  return PyList_Append(list, x);
1720 }
1721 #else
1722 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1723 #endif
1724 
1725 /* IterFinish.proto */
1726 static CYTHON_INLINE int __Pyx_IterFinish(void);
1727 
1728 /* set_iter.proto */
1729 static CYTHON_INLINE PyObject* __Pyx_set_iterator(PyObject* iterable, int is_set,
1730  Py_ssize_t* p_orig_length, int* p_source_is_set);
1731 static CYTHON_INLINE int __Pyx_set_iter_next(
1732  PyObject* iter_obj, Py_ssize_t orig_length,
1733  Py_ssize_t* ppos, PyObject **value,
1734  int source_is_set);
1735 
1736 /* PySequenceContains.proto */
1737 static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
1738  int result = PySequence_Contains(seq, item);
1739  return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
1740 }
1741 
1742 /* Import.proto */
1743 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1744 
1745 /* ImportFrom.proto */
1746 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1747 
1748 /* PyObjectCallNoArg.proto */
1749 #if CYTHON_COMPILING_IN_CPYTHON
1750 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1751 #else
1752 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1753 #endif
1754 
1755 /* DictGetItem.proto */
1756 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
1757 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
1758 #define __Pyx_PyObject_Dict_GetItem(obj, name)\
1759  (likely(PyDict_CheckExact(obj)) ?\
1760  __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
1761 #else
1762 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1763 #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name)
1764 #endif
1765 
1766 /* SliceObject.proto */
1767 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
1768  PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
1769  PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
1770  int has_cstart, int has_cstop, int wraparound);
1771 
1772 /* SetItemInt.proto */
1773 #define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1774  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1775  __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\
1776  (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
1777  __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
1778 static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
1779 static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
1780  int is_list, int wraparound, int boundscheck);
1781 
1782 /* PyThreadStateGet.proto */
1783 #if CYTHON_FAST_THREAD_STATE
1784 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1785 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1786 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1787 #else
1788 #define __Pyx_PyThreadState_declare
1789 #define __Pyx_PyThreadState_assign
1790 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1791 #endif
1792 
1793 /* PyErrFetchRestore.proto */
1794 #if CYTHON_FAST_THREAD_STATE
1795 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1796 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1797 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1798 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1799 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1800 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1801 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1802 #if CYTHON_COMPILING_IN_CPYTHON
1803 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1804 #else
1805 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1806 #endif
1807 #else
1808 #define __Pyx_PyErr_Clear() PyErr_Clear()
1809 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1810 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1811 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1812 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1813 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1814 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1815 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1816 #endif
1817 
1818 /* WriteUnraisableException.proto */
1819 static void __Pyx_WriteUnraisable(const char *name, int clineno,
1820  int lineno, const char *filename,
1821  int full_traceback, int nogil);
1822 
1823 /* ExtTypeTest.proto */
1824 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1825 
1826 /* IncludeStringH.proto */
1827 #include <string.h>
1828 
1829 /* RaiseException.proto */
1830 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1831 
1832 /* RaiseTooManyValuesToUnpack.proto */
1833 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1834 
1835 /* RaiseNeedMoreValuesToUnpack.proto */
1836 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1837 
1838 /* RaiseNoneIterError.proto */
1839 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1840 
1841 /* GetTopmostException.proto */
1842 #if CYTHON_USE_EXC_INFO_STACK
1843 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1844 #endif
1845 
1846 /* SaveResetException.proto */
1847 #if CYTHON_FAST_THREAD_STATE
1848 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1849 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1850 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1851 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1852 #else
1853 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1854 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1855 #endif
1856 
1857 /* PyErrExceptionMatches.proto */
1858 #if CYTHON_FAST_THREAD_STATE
1859 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1860 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1861 #else
1862 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1863 #endif
1864 
1865 /* GetException.proto */
1866 #if CYTHON_FAST_THREAD_STATE
1867 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1868 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1869 #else
1870 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1871 #endif
1872 
1873 /* ArgTypeTest.proto */
1874 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1875  ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1876  __Pyx__ArgTypeTest(obj, type, name, exact))
1877 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
1878 
1879 /* BytesEquals.proto */
1880 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
1881 
1882 /* UnicodeEquals.proto */
1883 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
1884 
1885 /* StrEquals.proto */
1886 #if PY_MAJOR_VERSION >= 3
1887 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
1888 #else
1889 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
1890 #endif
1891 
1892 /* UnaryNegOverflows.proto */
1893 #define UNARY_NEG_WOULD_OVERFLOW(x)\
1894  (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
1895 
1896 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
1897 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/
1898 /* GetAttr.proto */
1899 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1900 
1901 /* decode_c_string_utf16.proto */
1902 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
1903  int byteorder = 0;
1904  return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1905 }
1906 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
1907  int byteorder = -1;
1908  return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1909 }
1910 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
1911  int byteorder = 1;
1912  return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1913 }
1914 
1915 /* decode_c_string.proto */
1916 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
1917  const char* cstring, Py_ssize_t start, Py_ssize_t stop,
1918  const char* encoding, const char* errors,
1919  PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));
1920 
1921 /* GetAttr3.proto */
1922 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
1923 
1924 /* SwapException.proto */
1925 #if CYTHON_FAST_THREAD_STATE
1926 #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
1927 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1928 #else
1929 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
1930 #endif
1931 
1932 /* FastTypeChecks.proto */
1933 #if CYTHON_COMPILING_IN_CPYTHON
1934 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1935 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1936 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1937 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1938 #else
1939 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1940 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1941 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1942 #endif
1943 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1944 
1945 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
1946 /* ListCompAppend.proto */
1947 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1948 static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
1949  PyListObject* L = (PyListObject*) list;
1950  Py_ssize_t len = Py_SIZE(list);
1951  if (likely(L->allocated > len)) {
1952  Py_INCREF(x);
1953  PyList_SET_ITEM(list, len, x);
1954  Py_SIZE(list) = len+1;
1955  return 0;
1956  }
1957  return PyList_Append(list, x);
1958 }
1959 #else
1960 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
1961 #endif
1962 
1963 /* ListExtend.proto */
1964 static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
1965 #if CYTHON_COMPILING_IN_CPYTHON
1966  PyObject* none = _PyList_Extend((PyListObject*)L, v);
1967  if (unlikely(!none))
1968  return -1;
1969  Py_DECREF(none);
1970  return 0;
1971 #else
1972  return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
1973 #endif
1974 }
1975 
1976 /* None.proto */
1977 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
1978 
1979 /* HasAttr.proto */
1980 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
1981 
1982 /* StringJoin.proto */
1983 #if PY_MAJOR_VERSION < 3
1984 #define __Pyx_PyString_Join __Pyx_PyBytes_Join
1985 #define __Pyx_PyBaseString_Join(s, v) (PyUnicode_CheckExact(s) ? PyUnicode_Join(s, v) : __Pyx_PyBytes_Join(s, v))
1986 #else
1987 #define __Pyx_PyString_Join PyUnicode_Join
1988 #define __Pyx_PyBaseString_Join PyUnicode_Join
1989 #endif
1990 #if CYTHON_COMPILING_IN_CPYTHON
1991  #if PY_MAJOR_VERSION < 3
1992  #define __Pyx_PyBytes_Join _PyString_Join
1993  #else
1994  #define __Pyx_PyBytes_Join _PyBytes_Join
1995  #endif
1996 #else
1997 static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values);
1998 #endif
1999 
2000 /* PyObject_Unicode.proto */
2001 #if PY_MAJOR_VERSION >= 3
2002 #define __Pyx_PyObject_Unicode(obj)\
2003  (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Str(obj))
2004 #else
2005 #define __Pyx_PyObject_Unicode(obj)\
2006  (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Unicode(obj))
2007 #endif
2008 
2009 /* PyObject_GenericGetAttrNoDict.proto */
2010 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
2011 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
2012 #else
2013 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
2014 #endif
2015 
2016 /* PyObject_GenericGetAttr.proto */
2017 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
2018 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
2019 #else
2020 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
2021 #endif
2022 
2023 /* SetVTable.proto */
2024 static int __Pyx_SetVtable(PyObject *dict, void *vtable);
2025 
2026 /* SetupReduce.proto */
2027 static int __Pyx_setup_reduce(PyObject* type_obj);
2028 
2029 /* TypeImport.proto */
2030 #ifndef __PYX_HAVE_RT_ImportType_proto
2031 #define __PYX_HAVE_RT_ImportType_proto
2032 enum __Pyx_ImportType_CheckSize {
2033  __Pyx_ImportType_CheckSize_Error = 0,
2034  __Pyx_ImportType_CheckSize_Warn = 1,
2035  __Pyx_ImportType_CheckSize_Ignore = 2
2036 };
2037 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
2038 #endif
2039 
2040 /* CLineInTraceback.proto */
2041 #ifdef CYTHON_CLINE_IN_TRACEBACK
2042 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
2043 #else
2044 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
2045 #endif
2046 
2047 /* CodeObjectCache.proto */
2048 typedef struct {
2049  PyCodeObject* code_object;
2050  int code_line;
2051 } __Pyx_CodeObjectCacheEntry;
2052 struct __Pyx_CodeObjectCache {
2053  int count;
2054  int max_count;
2055  __Pyx_CodeObjectCacheEntry* entries;
2056 };
2057 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
2058 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
2059 static PyCodeObject *__pyx_find_code_object(int code_line);
2060 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
2061 
2062 /* AddTraceback.proto */
2063 static void __Pyx_AddTraceback(const char *funcname, int c_line,
2064  int py_line, const char *filename);
2065 
2066 #if PY_MAJOR_VERSION < 3
2067  static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
2068  static void __Pyx_ReleaseBuffer(Py_buffer *view);
2069 #else
2070  #define __Pyx_GetBuffer PyObject_GetBuffer
2071  #define __Pyx_ReleaseBuffer PyBuffer_Release
2072 #endif
2073 
2074 
2075 /* BufferStructDeclare.proto */
2076 typedef struct {
2077  Py_ssize_t shape, strides, suboffsets;
2078 } __Pyx_Buf_DimInfo;
2079 typedef struct {
2080  size_t refcount;
2081  Py_buffer pybuffer;
2082 } __Pyx_Buffer;
2083 typedef struct {
2084  __Pyx_Buffer *rcbuffer;
2085  char *data;
2086  __Pyx_Buf_DimInfo diminfo[8];
2087 } __Pyx_LocalBuf_ND;
2088 
2089 /* MemviewSliceIsContig.proto */
2090 static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim);
2091 
2092 /* OverlappingSlices.proto */
2093 static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
2094  __Pyx_memviewslice *slice2,
2095  int ndim, size_t itemsize);
2096 
2097 /* Capsule.proto */
2098 static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig);
2099 
2100 /* IsLittleEndian.proto */
2101 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);
2102 
2103 /* BufferFormatCheck.proto */
2104 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
2105 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
2106  __Pyx_BufFmt_StackElem* stack,
2107  __Pyx_TypeInfo* type);
2108 
2109 /* TypeInfoCompare.proto */
2110 static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
2111 
2112 /* MemviewSliceValidateAndInit.proto */
2113 static int __Pyx_ValidateAndInit_memviewslice(
2114  int *axes_specs,
2115  int c_or_f_flag,
2116  int buf_flags,
2117  int ndim,
2118  __Pyx_TypeInfo *dtype,
2119  __Pyx_BufFmt_StackElem stack[],
2120  __Pyx_memviewslice *memviewslice,
2121  PyObject *original_obj);
2122 
2123 /* ObjectToMemviewSlice.proto */
2124 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_double(PyObject *, int writable_flag);
2125 
2126 /* ObjectToMemviewSlice.proto */
2127 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_int(PyObject *, int writable_flag);
2128 
2129 /* ObjectToMemviewSlice.proto */
2130 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_double(PyObject *, int writable_flag);
2131 
2132 /* ObjectToMemviewSlice.proto */
2133 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_int(PyObject *, int writable_flag);
2134 
2135 /* ObjectToMemviewSlice.proto */
2136 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(PyObject *, int writable_flag);
2137 
2138 /* ObjectToMemviewSlice.proto */
2139 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(PyObject *, int writable_flag);
2140 
2141 /* MemviewDtypeToObject.proto */
2142 static CYTHON_INLINE PyObject *__pyx_memview_get_double(const char *itemp);
2143 static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *obj);
2144 
2145 /* CIntToPy.proto */
2146 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
2147 
2148 /* MemviewDtypeToObject.proto */
2149 static CYTHON_INLINE PyObject *__pyx_memview_get_int(const char *itemp);
2150 static CYTHON_INLINE int __pyx_memview_set_int(const char *itemp, PyObject *obj);
2151 
2152 /* CIntToPy.proto */
2153 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
2154 
2155 /* RealImag.proto */
2156 #if CYTHON_CCOMPLEX
2157  #ifdef __cplusplus
2158  #define __Pyx_CREAL(z) ((z).real())
2159  #define __Pyx_CIMAG(z) ((z).imag())
2160  #else
2161  #define __Pyx_CREAL(z) (__real__(z))
2162  #define __Pyx_CIMAG(z) (__imag__(z))
2163  #endif
2164 #else
2165  #define __Pyx_CREAL(z) ((z).real)
2166  #define __Pyx_CIMAG(z) ((z).imag)
2167 #endif
2168 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
2169  && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
2170  #define __Pyx_SET_CREAL(z,x) ((z).real(x))
2171  #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
2172 #else
2173  #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
2174  #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
2175 #endif
2176 
2177 /* Arithmetic.proto */
2178 #if CYTHON_CCOMPLEX
2179  #define __Pyx_c_eq_float(a, b) ((a)==(b))
2180  #define __Pyx_c_sum_float(a, b) ((a)+(b))
2181  #define __Pyx_c_diff_float(a, b) ((a)-(b))
2182  #define __Pyx_c_prod_float(a, b) ((a)*(b))
2183  #define __Pyx_c_quot_float(a, b) ((a)/(b))
2184  #define __Pyx_c_neg_float(a) (-(a))
2185  #ifdef __cplusplus
2186  #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
2187  #define __Pyx_c_conj_float(z) (::std::conj(z))
2188  #if 1
2189  #define __Pyx_c_abs_float(z) (::std::abs(z))
2190  #define __Pyx_c_pow_float(a, b) (::std::pow(a, b))
2191  #endif
2192  #else
2193  #define __Pyx_c_is_zero_float(z) ((z)==0)
2194  #define __Pyx_c_conj_float(z) (conjf(z))
2195  #if 1
2196  #define __Pyx_c_abs_float(z) (cabsf(z))
2197  #define __Pyx_c_pow_float(a, b) (cpowf(a, b))
2198  #endif
2199  #endif
2200 #else
2201  static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
2202  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
2203  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
2204  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
2205  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
2206  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
2207  static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
2208  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
2209  #if 1
2210  static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
2211  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
2212  #endif
2213 #endif
2214 
2215 /* Arithmetic.proto */
2216 #if CYTHON_CCOMPLEX
2217  #define __Pyx_c_eq_double(a, b) ((a)==(b))
2218  #define __Pyx_c_sum_double(a, b) ((a)+(b))
2219  #define __Pyx_c_diff_double(a, b) ((a)-(b))
2220  #define __Pyx_c_prod_double(a, b) ((a)*(b))
2221  #define __Pyx_c_quot_double(a, b) ((a)/(b))
2222  #define __Pyx_c_neg_double(a) (-(a))
2223  #ifdef __cplusplus
2224  #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
2225  #define __Pyx_c_conj_double(z) (::std::conj(z))
2226  #if 1
2227  #define __Pyx_c_abs_double(z) (::std::abs(z))
2228  #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
2229  #endif
2230  #else
2231  #define __Pyx_c_is_zero_double(z) ((z)==0)
2232  #define __Pyx_c_conj_double(z) (conj(z))
2233  #if 1
2234  #define __Pyx_c_abs_double(z) (cabs(z))
2235  #define __Pyx_c_pow_double(a, b) (cpow(a, b))
2236  #endif
2237  #endif
2238 #else
2239  static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
2240  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
2241  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
2242  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
2243  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
2244  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
2245  static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
2246  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
2247  #if 1
2248  static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
2249  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
2250  #endif
2251 #endif
2252 
2253 /* CIntToPy.proto */
2254 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);
2255 
2256 /* MemviewSliceCopyTemplate.proto */
2257 static __Pyx_memviewslice
2258 __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
2259  const char *mode, int ndim,
2260  size_t sizeof_dtype, int contig_flag,
2261  int dtype_is_object);
2262 
2263 /* CIntFromPy.proto */
2264 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
2265 
2266 /* TypeInfoToFormat.proto */
2267 struct __pyx_typeinfo_string {
2268  char string[3];
2269 };
2270 static struct __pyx_typeinfo_string __Pyx_TypeInfoToFormat(__Pyx_TypeInfo *type);
2271 
2272 /* CIntFromPy.proto */
2273 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
2274 
2275 /* CopyContentsUtility.proto */
2276 #define __pyx_memoryview_copy_slice_d_dc_double_c(slice)\
2277  __pyx_memoryview_copy_new_contig(&slice, "c", 2,\
2278  sizeof(double), (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT),\
2279  0)
2280 
2281 /* CopyContentsUtility.proto */
2282 #define __pyx_memoryview_copy_slice_dcd__double_f(slice)\
2283  __pyx_memoryview_copy_new_contig(&slice, "fortran", 2,\
2284  sizeof(double), (PyBUF_F_CONTIGUOUS | PyBUF_FORMAT),\
2285  0)
2286 
2287 /* CIntFromPy.proto */
2288 static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *);
2289 
2290 /* FetchCommonType.proto */
2291 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
2292 
2293 /* PyObjectGetMethod.proto */
2294 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
2295 
2296 /* PyObjectCallMethod1.proto */
2297 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
2298 
2299 /* CoroutineBase.proto */
2300 typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyThreadState *, PyObject *);
2301 #if CYTHON_USE_EXC_INFO_STACK
2302 #define __Pyx_ExcInfoStruct _PyErr_StackItem
2303 #else
2304 typedef struct {
2305  PyObject *exc_type;
2306  PyObject *exc_value;
2307  PyObject *exc_traceback;
2308 } __Pyx_ExcInfoStruct;
2309 #endif
2310 typedef struct {
2311  PyObject_HEAD
2312  __pyx_coroutine_body_t body;
2313  PyObject *closure;
2314  __Pyx_ExcInfoStruct gi_exc_state;
2315  PyObject *gi_weakreflist;
2316  PyObject *classobj;
2317  PyObject *yieldfrom;
2318  PyObject *gi_name;
2319  PyObject *gi_qualname;
2320  PyObject *gi_modulename;
2321  PyObject *gi_code;
2322  int resume_label;
2323  char is_running;
2324 } __pyx_CoroutineObject;
2325 static __pyx_CoroutineObject *__Pyx__Coroutine_New(
2326  PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
2327  PyObject *name, PyObject *qualname, PyObject *module_name);
2328 static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
2329  __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
2330  PyObject *name, PyObject *qualname, PyObject *module_name);
2331 static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self);
2332 static int __Pyx_Coroutine_clear(PyObject *self);
2333 static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
2334 static PyObject *__Pyx_Coroutine_Close(PyObject *self);
2335 static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
2336 #if CYTHON_USE_EXC_INFO_STACK
2337 #define __Pyx_Coroutine_SwapException(self)
2338 #define __Pyx_Coroutine_ResetAndClearException(self) __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state)
2339 #else
2340 #define __Pyx_Coroutine_SwapException(self) {\
2341  __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\
2342  __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\
2343  }
2344 #define __Pyx_Coroutine_ResetAndClearException(self) {\
2345  __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\
2346  (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\
2347  }
2348 #endif
2349 #if CYTHON_FAST_THREAD_STATE
2350 #define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
2351  __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue)
2352 #else
2353 #define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
2354  __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue)
2355 #endif
2356 static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue);
2357 static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state);
2358 
2359 /* PatchModuleWithCoroutine.proto */
2360 static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code);
2361 
2362 /* PatchGeneratorABC.proto */
2363 static int __Pyx_patch_abc(void);
2364 
2365 /* Generator.proto */
2366 #define __Pyx_Generator_USED
2367 static PyTypeObject *__pyx_GeneratorType = 0;
2368 #define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType)
2369 #define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\
2370  __Pyx__Coroutine_New(__pyx_GeneratorType, body, code, closure, name, qualname, module_name)
2371 static PyObject *__Pyx_Generator_Next(PyObject *self);
2372 static int __pyx_Generator_init(void);
2373 
2374 /* CheckBinaryVersion.proto */
2375 static int __Pyx_check_binary_version(void);
2376 
2377 /* FunctionExport.proto */
2378 static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);
2379 
2380 /* InitStrings.proto */
2381 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
2382 
2383 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/
2384 static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/
2385 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/
2386 static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/
2387 static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value); /* proto*/
2388 static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/
2389 static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
2390 static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
2391 static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
2392 static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
2393 
2394 /* Module declarations from 'cython.view' */
2395 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
2396 
2397 /* Module declarations from 'cython' */
2398 
2399 /* Module declarations from 'cpython.buffer' */
2400 
2401 /* Module declarations from 'libc.string' */
2402 
2403 /* Module declarations from 'libc.stdio' */
2404 
2405 /* Module declarations from '__builtin__' */
2406 
2407 /* Module declarations from 'cpython.type' */
2408 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
2409 
2410 /* Module declarations from 'cpython' */
2411 
2412 /* Module declarations from 'cpython.object' */
2413 
2414 /* Module declarations from 'cpython.ref' */
2415 
2416 /* Module declarations from 'cpython.mem' */
2417 
2418 /* Module declarations from 'numpy' */
2419 
2420 /* Module declarations from 'numpy' */
2421 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
2422 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
2423 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
2424 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
2425 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
2426 static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
2427 
2428 /* Module declarations from 'libcpp' */
2429 
2430 /* Module declarations from 'libc.math' */
2431 
2432 /* Module declarations from 'mprans.MeshSmoothing' */
2433 static PyTypeObject *__pyx_ptype_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues = 0;
2434 static PyTypeObject *__pyx_ptype_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr = 0;
2435 static PyTypeObject *__pyx_ptype_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr = 0;
2436 static PyTypeObject *__pyx_array_type = 0;
2437 static PyTypeObject *__pyx_MemviewEnum_type = 0;
2438 static PyTypeObject *__pyx_memoryview_type = 0;
2439 static PyTypeObject *__pyx_memoryviewslice_type = 0;
2440 static PyObject *generic = 0;
2441 static PyObject *strided = 0;
2442 static PyObject *indirect = 0;
2443 static PyObject *contiguous = 0;
2444 static PyObject *indirect_contiguous = 0;
2445 static int __pyx_memoryview_thread_locks_used;
2446 static PyThread_type_lock __pyx_memoryview_thread_locks[8];
2447 static void __pyx_f_6mprans_13MeshSmoothing_cySmoothNodesLaplace(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int, int, struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesLaplace *__pyx_optional_args); /*proto*/
2448 static void __pyx_f_6mprans_13MeshSmoothing_cySmoothNodesCentroid(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int, __Pyx_memviewslice, struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesCentroid *__pyx_optional_args); /*proto*/
2449 static void __pyx_f_6mprans_13MeshSmoothing_cyUpdateDilationElements(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int); /*proto*/
2450 static void __pyx_f_6mprans_13MeshSmoothing_cyUpdateDistortionElements(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int, int); /*proto*/
2451 static void __pyx_f_6mprans_13MeshSmoothing_cyUpdateInverseMeanRatioTriangleNodes(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int, int, struct __pyx_opt_args_6mprans_13MeshSmoothing_cyUpdateInverseMeanRatioTriangleNodes *__pyx_optional_args); /*proto*/
2452 static void __pyx_f_6mprans_13MeshSmoothing_cyUpdateInverseMeanRatioTriangleElements(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int); /*proto*/
2453 static double __pyx_f_6mprans_13MeshSmoothing_cyGetInverseMeanRatioSingleTriangle(int, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, struct __pyx_opt_args_6mprans_13MeshSmoothing_cyGetInverseMeanRatioSingleTriangle *__pyx_optional_args); /*proto*/
2454 static __Pyx_memviewslice __pyx_f_6mprans_13MeshSmoothing_cySmoothNodesQuality(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesQuality *__pyx_optional_args); /*proto*/
2455 static int __pyx_f_6mprans_13MeshSmoothing_pyxGetLocalNearestNode(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int); /*proto*/
2456 static int __pyx_f_6mprans_13MeshSmoothing_pyxGetLocalNearestElement(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int); /*proto*/
2457 static __Pyx_memviewslice __pyx_f_6mprans_13MeshSmoothing_pyxGetLocalNearestElementIntersection(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int); /*proto*/
2458 static int __pyx_f_6mprans_13MeshSmoothing_pyxGetLocalNearestElementAroundNode(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int); /*proto*/
2459 static void __pyx_f_6mprans_13MeshSmoothing_pyxUpdateElementBoundaryNormalsTetra(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int); /*proto*/
2460 static void __pyx_f_6mprans_13MeshSmoothing_pyxUpdateElementBoundaryNormalsTriangle(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int); /*proto*/
2461 static void __pyx_f_6mprans_13MeshSmoothing_cyUpdateElementVolumesTriangle(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int); /*proto*/
2462 static void __pyx_f_6mprans_13MeshSmoothing_cyUpdateElementVolumesTetra(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int); /*proto*/
2463 static void __pyx_f_6mprans_13MeshSmoothing_cyUpdateElementBarycenters(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int); /*proto*/
2464 static PyArrayObject *__pyx_f_6mprans_13MeshSmoothing_cyGetCornerNodesTriangle(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int); /*proto*/
2465 static __Pyx_memviewslice __pyx_f_6mprans_13MeshSmoothing_cyCheckOwnedVariable(int, int, int, __Pyx_memviewslice, __Pyx_memviewslice); /*proto*/
2466 static __Pyx_memviewslice __pyx_f_6mprans_13MeshSmoothing_cyScalarRecoveryAtNodes(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice); /*proto*/
2467 static __Pyx_memviewslice __pyx_f_6mprans_13MeshSmoothing_cyScalarRecoveryAtNodesWeighted(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int); /*proto*/
2468 static __Pyx_memviewslice __pyx_f_6mprans_13MeshSmoothing_cyVectorRecoveryAtNodesWeighted(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int); /*proto*/
2469 static __Pyx_memviewslice __pyx_f_6mprans_13MeshSmoothing_cyVectorRecoveryAtNodes(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int); /*proto*/
2470 static void __pyx_f_6mprans_13MeshSmoothing_cyFindBoundaryDirectionTriangle(__Pyx_memviewslice, int, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice); /*proto*/
2471 static void __pyx_f_6mprans_13MeshSmoothing_cyFindBoundaryDirectionTetra(__Pyx_memviewslice, int, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice); /*proto*/
2472 static double __pyx_f_6mprans_13MeshSmoothing_cyGetElementVolumeTriangle(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice); /*proto*/
2473 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
2474 static void *__pyx_align_pointer(void *, size_t); /*proto*/
2475 static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
2476 static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
2477 static PyObject *_unellipsify(PyObject *, int); /*proto*/
2478 static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
2479 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
2480 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/
2481 static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
2482 static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
2483 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
2484 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2485 static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2486 static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/
2487 static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2488 static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/
2489 static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/
2490 static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/
2491 static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/
2492 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/
2493 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/
2494 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/
2495 static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/
2496 static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/
2497 static int __pyx_memoryview_err(PyObject *, char *); /*proto*/
2498 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/
2499 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/
2500 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/
2501 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
2502 static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
2503 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/
2504 static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/
2505 static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/
2506 static PyObject *__pyx_format_from_typeinfo(__Pyx_TypeInfo *); /*proto*/
2507 static __Pyx_TypeInfo __Pyx_TypeInfo_int = { "int", NULL, sizeof(int), { 0 }, 0, IS_UNSIGNED(int) ? 'U' : 'I', IS_UNSIGNED(int), 0 };
2508 static __Pyx_TypeInfo __Pyx_TypeInfo_double = { "double", NULL, sizeof(double), { 0 }, 0, 'R', 0, 0 };
2509 #define __Pyx_MODULE_NAME "mprans.MeshSmoothing"
2510 extern int __pyx_module_is_main_mprans__MeshSmoothing;
2511 int __pyx_module_is_main_mprans__MeshSmoothing = 0;
2512 
2513 /* Implementation of 'mprans.MeshSmoothing' */
2514 static PyObject *__pyx_builtin_range;
2515 static PyObject *__pyx_builtin_enumerate;
2516 static PyObject *__pyx_builtin_ValueError;
2517 static PyObject *__pyx_builtin_RuntimeError;
2518 static PyObject *__pyx_builtin_ImportError;
2519 static PyObject *__pyx_builtin_MemoryError;
2520 static PyObject *__pyx_builtin_TypeError;
2521 static PyObject *__pyx_builtin_Ellipsis;
2522 static PyObject *__pyx_builtin_id;
2523 static PyObject *__pyx_builtin_IndexError;
2524 static const char __pyx_k_O[] = "O";
2525 static const char __pyx_k_T[] = "T{";
2526  static const char __pyx_k_c[] = "c";
2527  static const char __pyx_k_i[] = "i";
2528  static const char __pyx_k_s[] = "(%s)";
2529  static const char __pyx_k_x[] = "x";
2530  static const char __pyx_k_y[] = "y";
2531  static const char __pyx_k_z[] = "z";
2532  static const char __pyx_k_eN[] = "eN";
2533  static const char __pyx_k_iN[] = "iN";
2534  static const char __pyx_k_id[] = "id";
2535  static const char __pyx_k_ii[] = "ii";
2536  static const char __pyx_k_ir[] = "ir";
2537  static const char __pyx_k_nA[] = "nA";
2538  static const char __pyx_k_nB[] = "nB";
2539  static const char __pyx_k_nC[] = "nC";
2540  static const char __pyx_k_nd[] = "nd";
2541  static const char __pyx_k_np[] = "np";
2542  static const char __pyx_k_op[] = "op";
2543  static const char __pyx_k_x2[] = "x2";
2544  static const char __pyx_k_xi[] = "xi";
2545  static const char __pyx_k_y2[] = "y2";
2546  static const char __pyx_k_z2[] = "z2";
2547  static const char __pyx_k_INT[] = "INT";
2548  static const char __pyx_k_MPI[] = "MPI";
2549  static const char __pyx_k_SUM[] = "SUM";
2550  static const char __pyx_k__31[] = "^";
2551  static const char __pyx_k__32[] = "";
2552  static const char __pyx_k__33[] = ":";
2553 static const char __pyx_k__34[] = "}";
2554 static const char __pyx_k__35[] = ",";
2555 static const char __pyx_k_dot[] = "dot";
2556 static const char __pyx_k_get[] = "get";
2557 static const char __pyx_k_inv[] = "inv";
2558 static const char __pyx_k_new[] = "__new__";
2559 static const char __pyx_k_obj[] = "obj";
2560 static const char __pyx_k_Comm[] = "Comm";
2561 static const char __pyx_k_args[] = "args_";
2562 static const char __pyx_k_base[] = "base";
2563 static const char __pyx_k_comm[] = "comm";
2564 static const char __pyx_k_dict[] = "__dict__";
2565 static const char __pyx_k_disp[] = "disp";
2566 static const char __pyx_k_join[] = "join";
2567 static const char __pyx_k_main[] = "__main__";
2568 static const char __pyx_k_mesh[] = "mesh";
2569 static const char __pyx_k_mode[] = "mode";
2570 static const char __pyx_k_name[] = "name";
2571 static const char __pyx_k_ndim[] = "ndim";
2572 static const char __pyx_k_node[] = "node";
2573 static const char __pyx_k_pack[] = "pack";
2574 static const char __pyx_k_rank[] = "rank";
2575 static const char __pyx_k_root[] = "root";
2576 static const char __pyx_k_send[] = "send";
2577 static const char __pyx_k_size[] = "size";
2578 static const char __pyx_k_step[] = "step";
2579 static const char __pyx_k_stop[] = "stop";
2580 static const char __pyx_k_test[] = "__test__";
2581 static const char __pyx_k_ASCII[] = "ASCII";
2582 static const char __pyx_k_alpha[] = "alpha";
2583 static const char __pyx_k_array[] = "array";
2584 static const char __pyx_k_class[] = "__class__";
2585 static const char __pyx_k_close[] = "close";
2586 static const char __pyx_k_dtype[] = "dtype";
2587 static const char __pyx_k_error[] = "error";
2588 static const char __pyx_k_flags[] = "flags";
2589 static const char __pyx_k_int32[] = "int32";
2590 static const char __pyx_k_maxit[] = "maxit";
2591 static const char __pyx_k_node0[] = "node0";
2592 static const char __pyx_k_numpy[] = "numpy";
2593 static const char __pyx_k_range[] = "range";
2594 static const char __pyx_k_shape[] = "shape";
2595 static const char __pyx_k_start[] = "start";
2596 static const char __pyx_k_throw[] = "throw";
2597 static const char __pyx_k_zeros[] = "zeros";
2598 static const char __pyx_k_Commit[] = "Commit";
2599 static const char __pyx_k_DOUBLE[] = "DOUBLE";
2600 static const char __pyx_k_append[] = "append";
2601 static const char __pyx_k_args_2[] = "args";
2602 static const char __pyx_k_astype[] = "astype";
2603 static const char __pyx_k_coords[] = "coords";
2604 static const char __pyx_k_double[] = "double";
2605 static const char __pyx_k_encode[] = "encode";
2606 static const char __pyx_k_format[] = "format";
2607 static const char __pyx_k_import[] = "__import__";
2608 static const char __pyx_k_linalg[] = "linalg";
2609 static const char __pyx_k_mpi4py[] = "mpi4py";
2610 static const char __pyx_k_nNodes[] = "nNodes";
2611 static const char __pyx_k_name_2[] = "__name__";
2612 static const char __pyx_k_pickle[] = "pickle";
2613 static const char __pyx_k_reduce[] = "__reduce__";
2614 static const char __pyx_k_result[] = "result";
2615 static const char __pyx_k_struct[] = "struct";
2616 static const char __pyx_k_sumtot[] = "sumtot";
2617 static const char __pyx_k_unpack[] = "unpack";
2618 static const char __pyx_k_update[] = "update";
2619 static const char __pyx_k_Gatherv[] = "Gatherv";
2620 static const char __pyx_k_J_array[] = "J_array";
2621 static const char __pyx_k_eOffset[] = "eOffset";
2622 static const char __pyx_k_fortran[] = "fortran";
2623 static const char __pyx_k_genexpr[] = "genexpr";
2624 static const char __pyx_k_memview[] = "memview";
2625 static const char __pyx_k_my_rank[] = "my_rank";
2626 static const char __pyx_k_my_size[] = "my_size";
2627 static const char __pyx_k_proteus[] = "proteus";
2628 static const char __pyx_k_scalars[] = "scalars";
2629 static const char __pyx_k_vectors[] = "vectors";
2630 static const char __pyx_k_Ellipsis[] = "Ellipsis";
2631 static const char __pyx_k_datatype[] = "datatype";
2632 static const char __pyx_k_dilation[] = "dilation";
2633 static const char __pyx_k_femSpace[] = "femSpace";
2634 static const char __pyx_k_getstate[] = "__getstate__";
2635 static const char __pyx_k_itemsize[] = "itemsize";
2636 static const char __pyx_k_logEvent[] = "logEvent";
2637 static const char __pyx_k_new_rank[] = "new_rank";
2638 static const char __pyx_k_pyx_type[] = "__pyx_type";
2639 static const char __pyx_k_setstate[] = "__setstate__";
2640 static const char __pyx_k_tompi4py[] = "tompi4py";
2641 static const char __pyx_k_TypeError[] = "TypeError";
2642 static const char __pyx_k_allreduce[] = "allreduce";
2643 static const char __pyx_k_arg_2rank[] = "arg_2rank";
2644 static const char __pyx_k_arg_shape[] = "arg_shape";
2645 static const char __pyx_k_comm_size[] = "comm_size";
2646 static const char __pyx_k_counts_in[] = "counts_in";
2647 static const char __pyx_k_enumerate[] = "enumerate";
2648 static const char __pyx_k_nElements[] = "nElements";
2649 static const char __pyx_k_nodeArray[] = "nodeArray_";
2650 static const char __pyx_k_onElement[] = "onElement";
2651 static const char __pyx_k_pyx_state[] = "__pyx_state";
2652 static const char __pyx_k_rank_recv[] = "rank_recv";
2653 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
2654 static const char __pyx_k_transpose[] = "transpose";
2655 static const char __pyx_k_IndexError[] = "IndexError";
2656 static const char __pyx_k_ValueError[] = "ValueError";
2657 static const char __pyx_k_array_size[] = "array_size";
2658 static const char __pyx_k_counts_out[] = "counts_out";
2659 static const char __pyx_k_detJ_array[] = "detJ_array";
2660 static const char __pyx_k_distortion[] = "distortion";
2661 static const char __pyx_k_el_average[] = "el_average";
2662 static const char __pyx_k_nearest_eN[] = "nearest_eN";
2663 static const char __pyx_k_pyx_result[] = "__pyx_result";
2664 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
2665 static const char __pyx_k_zeros_like[] = "zeros_like";
2666 static const char __pyx_k_ImportError[] = "ImportError";
2667 static const char __pyx_k_MemoryError[] = "MemoryError";
2668 static const char __pyx_k_PickleError[] = "PickleError";
2669 static const char __pyx_k_elementMaps[] = "elementMaps";
2670 static const char __pyx_k_nodeArray_2[] = "nodeArray";
2671 static const char __pyx_k_nodes_2rank[] = "nodes_2rank";
2672 static const char __pyx_k_RuntimeError[] = "RuntimeError";
2673 static const char __pyx_k_arg_2doArray[] = "arg_2doArray";
2674 static const char __pyx_k_nNodes_owned[] = "nNodes_owned";
2675 static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
2676 static const char __pyx_k_shape_factor[] = "shape_factor";
2677 static const char __pyx_k_simultaneous[] = "simultaneous";
2678 static const char __pyx_k_stringsource[] = "stringsource";
2679 static const char __pyx_k_IMRNodesArray[] = "IMRNodesArray_";
2680 static const char __pyx_k_arg_shape_len[] = "arg_shape_len";
2681 static const char __pyx_k_nNodes_global[] = "nNodes_global";
2682 static const char __pyx_k_nodeStarArray[] = "nodeStarArray";
2683 static const char __pyx_k_node_new_rank[] = "node_new_rank";
2684 static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer";
2685 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
2686 static const char __pyx_k_apply_directly[] = "apply_directly";
2687 static const char __pyx_k_arg_shape_copy[] = "arg_shape_copy";
2688 static const char __pyx_k_nodes_2doArray[] = "nodes_2doArray";
2689 static const char __pyx_k_View_MemoryView[] = "View.MemoryView";
2690 static const char __pyx_k_allocate_buffer[] = "allocate_buffer";
2691 static const char __pyx_k_checkedElements[] = "checkedElements";
2692 static const char __pyx_k_dtype_is_object[] = "dtype_is_object";
2693 static const char __pyx_k_getInverseValue[] = "getInverseValue";
2694 static const char __pyx_k_getLocalElement[] = "getLocalElement";
2695 static const char __pyx_k_nodeStarOffsets[] = "nodeStarOffsets";
2696 static const char __pyx_k_nodes_2rank_len[] = "nodes_2rank_len";
2697 static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
2698 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
2699 static const char __pyx_k_starting_coords[] = "starting_coords";
2700 static const char __pyx_k_IMRElementsArray[] = "IMRElementsArray_";
2701 static const char __pyx_k_arg_2rank_values[] = "arg_2rank_values";
2702 static const char __pyx_k_displacements_in[] = "displacements_in";
2703 static const char __pyx_k_nVariables_owned[] = "nVariables_owned";
2704 static const char __pyx_k_referenceElement[] = "referenceElement";
2705 static const char __pyx_k_smoothBoundaries[] = "smoothBoundaries";
2706 static const char __pyx_k_Create_contiguous[] = "Create_contiguous";
2707 static const char __pyx_k_displacements_out[] = "displacements_out";
2708 static const char __pyx_k_elementNodesArray[] = "elementNodesArray";
2709 static const char __pyx_k_nodeElementsArray[] = "nodeElementsArray";
2710 static const char __pyx_k_nodeMaterialTypes[] = "nodeMaterialTypes";
2711 static const char __pyx_k_proteus_Profiling[] = "proteus.Profiling";
2712 static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum";
2713 static const char __pyx_k_variable_nb_local[] = "variable_nb_local";
2714 static const char __pyx_k_checkOwnedVariable[] = "checkOwnedVariable";
2715 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
2716 static const char __pyx_k_elementVolumeArray[] = "elementVolumeArray";
2717 static const char __pyx_k_nodeElementOffsets[] = "nodeElementOffsets";
2718 static const char __pyx_k_nodes_2rank_values[] = "nodes_2rank_values";
2719 static const char __pyx_k_patchBoundaryNodes[] = "patchBoundaryNodes";
2720 static const char __pyx_k_smoothNodesLaplace[] = "smoothNodesLaplace";
2721 static const char __pyx_k_smoothNodesQuality[] = "smoothNodesQuality";
2722 static const char __pyx_k_strided_and_direct[] = "<strided and direct>";
2723 static const char __pyx_k_elementVolumesArray[] = "elementVolumesArray";
2724 static const char __pyx_k_fixedNodesBoolArray[] = "fixedNodesBoolArray";
2725 static const char __pyx_k_getDilationElements[] = "getDilationElements";
2726 static const char __pyx_k_getLocalNearestNode[] = "getLocalNearestNode";
2727 static const char __pyx_k_smoothNodesCentroid[] = "smoothNodesCentroid";
2728 static const char __pyx_k_elementDilationArray[] = "elementDilationArray_";
2729 static const char __pyx_k_mprans_MeshSmoothing[] = "mprans.MeshSmoothing";
2730 static const char __pyx_k_strided_and_indirect[] = "<strided and indirect>";
2731 static const char __pyx_k_contiguous_and_direct[] = "<contiguous and direct>";
2732 static const char __pyx_k_elementNeighborsArray[] = "elementNeighborsArray";
2733 static const char __pyx_k_elementVolumesArray_2[] = "elementVolumesArray_";
2734 static const char __pyx_k_error_looking_for_dir[] = "error looking for dir_";
2735 static const char __pyx_k_getDistortionElements[] = "getDistortionElements";
2736 static const char __pyx_k_getNonOwnedNodeValues[] = "getNonOwnedNodeValues";
2737 static const char __pyx_k_MemoryView_of_r_object[] = "<MemoryView of %r object>";
2738 static const char __pyx_k_elementBoundariesArray[] = "elementBoundariesArray";
2739 static const char __pyx_k_elementDistortionArray[] = "elementDistortionArray_";
2740 static const char __pyx_k_getCornerNodesTriangle[] = "getCornerNodesTriangle";
2741 static const char __pyx_k_getLocalNearestElement[] = "getLocalNearestElement";
2742 static const char __pyx_k_updateDilationElements[] = "updateDilationElements";
2743 static const char __pyx_k_MemoryView_of_r_at_0x_x[] = "<MemoryView of %r at 0x%x>";
2744 static const char __pyx_k_contiguous_and_indirect[] = "<contiguous and indirect>";
2745 static const char __pyx_k_elementBarycentersArray[] = "elementBarycentersArray";
2746 static const char __pyx_k_pyScalarRecoveryAtNodes[] = "pyScalarRecoveryAtNodes";
2747 static const char __pyx_k_pyVectorRecoveryAtNodes[] = "pyVectorRecoveryAtNodes";
2748 static const char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'";
2749 static const char __pyx_k_elementVolumeTargetArray[] = "elementVolumeTargetArray";
2750 static const char __pyx_k_getElementVolumeTriangle[] = "getElementVolumeTriangle";
2751 static const char __pyx_k_updateDistortionElements[] = "updateDistortionElements";
2752 static const char __pyx_k_updateElementBarycenters[] = "updateElementBarycenters";
2753 static const char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d.";
2754 static const char __pyx_k_elementBarycentersArray_2[] = "elementBarycentersArray_";
2755 static const char __pyx_k_elementBoundaryNodesArray[] = "elementBoundaryNodesArray";
2756 static const char __pyx_k_updateElementVolumesTetra[] = "updateElementVolumesTetra";
2757 static const char __pyx_k_elementBoundaryNormalsArray[] = "elementBoundaryNormalsArray";
2758 static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array";
2759 static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
2760 static const char __pyx_k_nodeOffsets_subdomain_owned[] = "nodeOffsets_subdomain_owned";
2761 static const char __pyx_k_elementBoundaryElementsArray[] = "elementBoundaryElementsArray";
2762 static const char __pyx_k_updateElementVolumesTriangle[] = "updateElementVolumesTriangle";
2763 static const char __pyx_k_elementBoundaryNormalsArray_2[] = "elementBoundaryNormalsArray_";
2764 static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data.";
2765 static const char __pyx_k_getElementBoundaryNormalsTetra[] = "getElementBoundaryNormalsTetra";
2766 static const char __pyx_k_nodeNumbering_subdomain2global[] = "nodeNumbering_subdomain2global";
2767 static const char __pyx_k_strided_and_direct_or_indirect[] = "<strided and direct or indirect>";
2768 static const char __pyx_k_elementBoundaryBarycentersArray[] = "elementBoundaryBarycentersArray";
2769 static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
2770 static const char __pyx_k_pyScalarRecoveryAtNodesWeighted[] = "pyScalarRecoveryAtNodesWeighted";
2771 static const char __pyx_k_pyVectorRecoveryAtNodesWeighted[] = "pyVectorRecoveryAtNodesWeighted";
2772 static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
2773 static const char __pyx_k_variableOffsets_subdomain_owned[] = "variableOffsets_subdomain_owned";
2774 static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides";
2775 static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory.";
2776 static const char __pyx_k_Cannot_assign_to_read_only_memor[] = "Cannot assign to read-only memoryview";
2777 static const char __pyx_k_Cannot_create_writable_memory_vi[] = "Cannot create writable memory view from read-only memoryview";
2778 static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array";
2779 static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
2780 static const char __pyx_k_Incompatible_checksums_s_vs_0xb0[] = "Incompatible checksums (%s vs 0xb068931 = (name))";
2781 static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported";
2782 static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s";
2783 static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
2784 static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis %d)";
2785 static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object";
2786 static const char __pyx_k_could_not_find_element_element_e[] = "could not find element! (element {eN}: {x}, {y}, {z}), nearest_eN {nearest_eN}: closest coords: {x2}, {y2}, {z2}, after {maxit} iterations";
2787 static const char __pyx_k_exteriorElementBoundariesBoolArr[] = "exteriorElementBoundariesBoolArray";
2788 static const char __pyx_k_getElementBoundaryNormalsTriangl[] = "getElementBoundaryNormalsTriangle";
2789 static const char __pyx_k_getInverseMeanRatioSingleTriangl[] = "getInverseMeanRatioSingleTriangle";
2790 static const char __pyx_k_getInverseMeanRatioTriangleEleme[] = "getInverseMeanRatioTriangleElements";
2791 static const char __pyx_k_getInverseMeanRatioTriangleNodes[] = "getInverseMeanRatioTriangleNodes";
2792 static const char __pyx_k_getLocalNearestElementAroundNode[] = "getLocalNearestElementAroundNode";
2793 static const char __pyx_k_getLocalNearestElementIntersecti[] = "getLocalNearestElementIntersection";
2794 static const char __pyx_k_getNonOwnedNodeValues_locals_gen[] = "getNonOwnedNodeValues.<locals>.genexpr";
2795 static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension %d (got %d and %d)";
2796 static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous";
2797 static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
2798 static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
2799 static const char __pyx_k_proteus_mprans_MeshSmoothing_pyx[] = "proteus/mprans/MeshSmoothing.pyx";
2800 static const char __pyx_k_smoothNodesQuality_is_work_in_pr[] = "smoothNodesQuality is work in progress, do not use";
2801 static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides.";
2802 static const char __pyx_k_updateElementBoundaryNormalsTetr[] = "updateElementBoundaryNormalsTetra";
2803 static const char __pyx_k_updateElementBoundaryNormalsTria[] = "updateElementBoundaryNormalsTriangle";
2804 static const char __pyx_k_updateInverseMeanRatioTriangleEl[] = "updateInverseMeanRatioTriangleElements";
2805 static const char __pyx_k_updateInverseMeanRatioTriangleNo[] = "updateInverseMeanRatioTriangleNodes";
2806 static const char __pyx_k_variableNumbering_subdomain2glob[] = "variableNumbering_subdomain2global";
2807 static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
2808 static PyObject *__pyx_n_s_ASCII;
2809 static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri;
2810 static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is;
2811 static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor;
2812 static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi;
2813 static PyObject *__pyx_kp_s_Cannot_index_with_type_s;
2814 static PyObject *__pyx_n_s_Comm;
2815 static PyObject *__pyx_n_s_Commit;
2816 static PyObject *__pyx_n_s_Create_contiguous;
2817 static PyObject *__pyx_n_s_DOUBLE;
2818 static PyObject *__pyx_n_s_Ellipsis;
2819 static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr;
2820 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
2821 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
2822 static PyObject *__pyx_n_s_Gatherv;
2823 static PyObject *__pyx_n_s_IMRElementsArray;
2824 static PyObject *__pyx_n_s_IMRNodesArray;
2825 static PyObject *__pyx_n_s_INT;
2826 static PyObject *__pyx_n_s_ImportError;
2827 static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xb0;
2828 static PyObject *__pyx_n_s_IndexError;
2829 static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte;
2830 static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr;
2831 static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d;
2832 static PyObject *__pyx_n_s_J_array;
2833 static PyObject *__pyx_n_s_MPI;
2834 static PyObject *__pyx_n_s_MemoryError;
2835 static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x;
2836 static PyObject *__pyx_kp_s_MemoryView_of_r_object;
2837 static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
2838 static PyObject *__pyx_n_b_O;
2839 static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a;
2840 static PyObject *__pyx_n_s_PickleError;
2841 static PyObject *__pyx_n_s_RuntimeError;
2842 static PyObject *__pyx_n_s_SUM;
2843 static PyObject *__pyx_kp_b_T;
2844 static PyObject *__pyx_n_s_TypeError;
2845 static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object;
2846 static PyObject *__pyx_n_s_ValueError;
2847 static PyObject *__pyx_n_s_View_MemoryView;
2848 static PyObject *__pyx_kp_b__31;
2849 static PyObject *__pyx_kp_b__32;
2850 static PyObject *__pyx_kp_b__33;
2851 static PyObject *__pyx_kp_b__34;
2852 static PyObject *__pyx_kp_u__35;
2853 static PyObject *__pyx_n_s_allocate_buffer;
2854 static PyObject *__pyx_n_s_allreduce;
2855 static PyObject *__pyx_n_s_alpha;
2856 static PyObject *__pyx_n_s_append;
2857 static PyObject *__pyx_n_s_apply_directly;
2858 static PyObject *__pyx_n_s_arg_2doArray;
2859 static PyObject *__pyx_n_s_arg_2rank;
2860 static PyObject *__pyx_n_s_arg_2rank_values;
2861 static PyObject *__pyx_n_s_arg_shape;
2862 static PyObject *__pyx_n_s_arg_shape_copy;
2863 static PyObject *__pyx_n_s_arg_shape_len;
2864 static PyObject *__pyx_n_s_args;
2865 static PyObject *__pyx_n_s_args_2;
2866 static PyObject *__pyx_n_s_array;
2867 static PyObject *__pyx_n_s_array_size;
2868 static PyObject *__pyx_n_s_astype;
2869 static PyObject *__pyx_n_s_base;
2870 static PyObject *__pyx_n_s_c;
2871 static PyObject *__pyx_n_u_c;
2872 static PyObject *__pyx_n_s_checkOwnedVariable;
2873 static PyObject *__pyx_n_s_checkedElements;
2874 static PyObject *__pyx_n_s_class;
2875 static PyObject *__pyx_n_s_cline_in_traceback;
2876 static PyObject *__pyx_n_s_close;
2877 static PyObject *__pyx_n_s_comm;
2878 static PyObject *__pyx_n_s_comm_size;
2879 static PyObject *__pyx_kp_s_contiguous_and_direct;
2880 static PyObject *__pyx_kp_s_contiguous_and_indirect;
2881 static PyObject *__pyx_n_s_coords;
2882 static PyObject *__pyx_kp_s_could_not_find_element_element_e;
2883 static PyObject *__pyx_n_s_counts_in;
2884 static PyObject *__pyx_n_s_counts_out;
2885 static PyObject *__pyx_n_s_datatype;
2886 static PyObject *__pyx_n_s_detJ_array;
2887 static PyObject *__pyx_n_s_dict;
2888 static PyObject *__pyx_n_s_dilation;
2889 static PyObject *__pyx_n_s_disp;
2890 static PyObject *__pyx_n_s_displacements_in;
2891 static PyObject *__pyx_n_s_displacements_out;
2892 static PyObject *__pyx_n_s_distortion;
2893 static PyObject *__pyx_n_s_dot;
2894 static PyObject *__pyx_n_s_double;
2895 static PyObject *__pyx_n_s_dtype;
2896 static PyObject *__pyx_n_s_dtype_is_object;
2897 static PyObject *__pyx_n_s_eN;
2898 static PyObject *__pyx_n_s_eOffset;
2899 static PyObject *__pyx_n_s_el_average;
2900 static PyObject *__pyx_n_s_elementBarycentersArray;
2901 static PyObject *__pyx_n_s_elementBarycentersArray_2;
2902 static PyObject *__pyx_n_s_elementBoundariesArray;
2903 static PyObject *__pyx_n_s_elementBoundaryBarycentersArray;
2904 static PyObject *__pyx_n_s_elementBoundaryElementsArray;
2905 static PyObject *__pyx_n_s_elementBoundaryNodesArray;
2906 static PyObject *__pyx_n_s_elementBoundaryNormalsArray;
2907 static PyObject *__pyx_n_s_elementBoundaryNormalsArray_2;
2908 static PyObject *__pyx_n_s_elementDilationArray;
2909 static PyObject *__pyx_n_s_elementDistortionArray;
2910 static PyObject *__pyx_n_s_elementMaps;
2911 static PyObject *__pyx_n_s_elementNeighborsArray;
2912 static PyObject *__pyx_n_s_elementNodesArray;
2913 static PyObject *__pyx_n_s_elementVolumeArray;
2914 static PyObject *__pyx_n_s_elementVolumeTargetArray;
2915 static PyObject *__pyx_n_s_elementVolumesArray;
2916 static PyObject *__pyx_n_s_elementVolumesArray_2;
2917 static PyObject *__pyx_n_s_encode;
2918 static PyObject *__pyx_n_s_enumerate;
2919 static PyObject *__pyx_n_s_error;
2920 static PyObject *__pyx_kp_s_error_looking_for_dir;
2921 static PyObject *__pyx_n_s_exteriorElementBoundariesBoolArr;
2922 static PyObject *__pyx_n_s_femSpace;
2923 static PyObject *__pyx_n_s_fixedNodesBoolArray;
2924 static PyObject *__pyx_n_s_flags;
2925 static PyObject *__pyx_n_s_format;
2926 static PyObject *__pyx_n_s_fortran;
2927 static PyObject *__pyx_n_u_fortran;
2928 static PyObject *__pyx_n_s_genexpr;
2929 static PyObject *__pyx_n_s_get;
2930 static PyObject *__pyx_n_s_getCornerNodesTriangle;
2931 static PyObject *__pyx_n_s_getDilationElements;
2932 static PyObject *__pyx_n_s_getDistortionElements;
2933 static PyObject *__pyx_n_s_getElementBoundaryNormalsTetra;
2934 static PyObject *__pyx_n_s_getElementBoundaryNormalsTriangl;
2935 static PyObject *__pyx_n_s_getElementVolumeTriangle;
2936 static PyObject *__pyx_n_s_getInverseMeanRatioSingleTriangl;
2937 static PyObject *__pyx_n_s_getInverseMeanRatioTriangleEleme;
2938 static PyObject *__pyx_n_s_getInverseMeanRatioTriangleNodes;
2939 static PyObject *__pyx_n_s_getInverseValue;
2940 static PyObject *__pyx_n_s_getLocalElement;
2941 static PyObject *__pyx_n_s_getLocalNearestElement;
2942 static PyObject *__pyx_n_s_getLocalNearestElementAroundNode;
2943 static PyObject *__pyx_n_s_getLocalNearestElementIntersecti;
2944 static PyObject *__pyx_n_s_getLocalNearestNode;
2945 static PyObject *__pyx_n_s_getNonOwnedNodeValues;
2946 static PyObject *__pyx_n_s_getNonOwnedNodeValues_locals_gen;
2947 static PyObject *__pyx_n_s_getstate;
2948 static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi;
2949 static PyObject *__pyx_n_s_i;
2950 static PyObject *__pyx_n_s_iN;
2951 static PyObject *__pyx_n_s_id;
2952 static PyObject *__pyx_n_s_ii;
2953 static PyObject *__pyx_n_s_import;
2954 static PyObject *__pyx_n_s_int32;
2955 static PyObject *__pyx_n_s_inv;
2956 static PyObject *__pyx_n_s_ir;
2957 static PyObject *__pyx_n_s_itemsize;
2958 static PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
2959 static PyObject *__pyx_n_s_join;
2960 static PyObject *__pyx_n_s_linalg;
2961 static PyObject *__pyx_n_s_logEvent;
2962 static PyObject *__pyx_n_s_main;
2963 static PyObject *__pyx_n_s_maxit;
2964 static PyObject *__pyx_n_s_memview;
2965 static PyObject *__pyx_n_s_mesh;
2966 static PyObject *__pyx_n_s_mode;
2967 static PyObject *__pyx_n_s_mpi4py;
2968 static PyObject *__pyx_n_s_mprans_MeshSmoothing;
2969 static PyObject *__pyx_n_s_my_rank;
2970 static PyObject *__pyx_n_s_my_size;
2971 static PyObject *__pyx_n_s_nA;
2972 static PyObject *__pyx_n_s_nB;
2973 static PyObject *__pyx_n_s_nC;
2974 static PyObject *__pyx_n_s_nElements;
2975 static PyObject *__pyx_n_s_nNodes;
2976 static PyObject *__pyx_n_s_nNodes_global;
2977 static PyObject *__pyx_n_s_nNodes_owned;
2978 static PyObject *__pyx_n_s_nVariables_owned;
2979 static PyObject *__pyx_n_s_name;
2980 static PyObject *__pyx_n_s_name_2;
2981 static PyObject *__pyx_n_s_nd;
2982 static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous;
2983 static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou;
2984 static PyObject *__pyx_n_s_ndim;
2985 static PyObject *__pyx_n_s_nearest_eN;
2986 static PyObject *__pyx_n_s_new;
2987 static PyObject *__pyx_n_s_new_rank;
2988 static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
2989 static PyObject *__pyx_n_s_node;
2990 static PyObject *__pyx_n_s_node0;
2991 static PyObject *__pyx_n_s_nodeArray;
2992 static PyObject *__pyx_n_s_nodeArray_2;
2993 static PyObject *__pyx_n_s_nodeElementOffsets;
2994 static PyObject *__pyx_n_s_nodeElementsArray;
2995 static PyObject *__pyx_n_s_nodeMaterialTypes;
2996 static PyObject *__pyx_n_s_nodeNumbering_subdomain2global;
2997 static PyObject *__pyx_n_s_nodeOffsets_subdomain_owned;
2998 static PyObject *__pyx_n_s_nodeStarArray;
2999 static PyObject *__pyx_n_s_nodeStarOffsets;
3000 static PyObject *__pyx_n_s_node_new_rank;
3001 static PyObject *__pyx_n_s_nodes_2doArray;
3002 static PyObject *__pyx_n_s_nodes_2rank;
3003 static PyObject *__pyx_n_s_nodes_2rank_len;
3004 static PyObject *__pyx_n_s_nodes_2rank_values;
3005 static PyObject *__pyx_n_s_np;
3006 static PyObject *__pyx_n_s_numpy;
3007 static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
3008 static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
3009 static PyObject *__pyx_n_s_obj;
3010 static PyObject *__pyx_n_s_onElement;
3011 static PyObject *__pyx_n_s_op;
3012 static PyObject *__pyx_n_s_pack;
3013 static PyObject *__pyx_n_s_patchBoundaryNodes;
3014 static PyObject *__pyx_n_s_pickle;
3015 static PyObject *__pyx_n_s_proteus;
3016 static PyObject *__pyx_n_s_proteus_Profiling;
3017 static PyObject *__pyx_kp_s_proteus_mprans_MeshSmoothing_pyx;
3018 static PyObject *__pyx_n_s_pyScalarRecoveryAtNodes;
3019 static PyObject *__pyx_n_s_pyScalarRecoveryAtNodesWeighted;
3020 static PyObject *__pyx_n_s_pyVectorRecoveryAtNodes;
3021 static PyObject *__pyx_n_s_pyVectorRecoveryAtNodesWeighted;
3022 static PyObject *__pyx_n_s_pyx_PickleError;
3023 static PyObject *__pyx_n_s_pyx_checksum;
3024 static PyObject *__pyx_n_s_pyx_getbuffer;
3025 static PyObject *__pyx_n_s_pyx_result;
3026 static PyObject *__pyx_n_s_pyx_state;
3027 static PyObject *__pyx_n_s_pyx_type;
3028 static PyObject *__pyx_n_s_pyx_unpickle_Enum;
3029 static PyObject *__pyx_n_s_pyx_vtable;
3030 static PyObject *__pyx_n_s_range;
3031 static PyObject *__pyx_n_s_rank;
3032 static PyObject *__pyx_n_s_rank_recv;
3033 static PyObject *__pyx_n_s_reduce;
3034 static PyObject *__pyx_n_s_reduce_cython;
3035 static PyObject *__pyx_n_s_reduce_ex;
3036 static PyObject *__pyx_n_s_referenceElement;
3037 static PyObject *__pyx_n_s_result;
3038 static PyObject *__pyx_n_s_root;
3039 static PyObject *__pyx_kp_u_s;
3040 static PyObject *__pyx_n_s_scalars;
3041 static PyObject *__pyx_n_s_send;
3042 static PyObject *__pyx_n_s_setstate;
3043 static PyObject *__pyx_n_s_setstate_cython;
3044 static PyObject *__pyx_n_s_shape;
3045 static PyObject *__pyx_n_s_shape_factor;
3046 static PyObject *__pyx_n_s_simultaneous;
3047 static PyObject *__pyx_n_s_size;
3048 static PyObject *__pyx_n_s_smoothBoundaries;
3049 static PyObject *__pyx_n_s_smoothNodesCentroid;
3050 static PyObject *__pyx_n_s_smoothNodesLaplace;
3051 static PyObject *__pyx_n_s_smoothNodesQuality;
3052 static PyObject *__pyx_kp_s_smoothNodesQuality_is_work_in_pr;
3053 static PyObject *__pyx_n_s_start;
3054 static PyObject *__pyx_n_s_starting_coords;
3055 static PyObject *__pyx_n_s_step;
3056 static PyObject *__pyx_n_s_stop;
3057 static PyObject *__pyx_kp_s_strided_and_direct;
3058 static PyObject *__pyx_kp_s_strided_and_direct_or_indirect;
3059 static PyObject *__pyx_kp_s_strided_and_indirect;
3060 static PyObject *__pyx_kp_s_stringsource;
3061 static PyObject *__pyx_n_s_struct;
3062 static PyObject *__pyx_n_s_sumtot;
3063 static PyObject *__pyx_n_s_test;
3064 static PyObject *__pyx_n_s_throw;
3065 static PyObject *__pyx_n_s_tompi4py;
3066 static PyObject *__pyx_n_s_transpose;
3067 static PyObject *__pyx_kp_s_unable_to_allocate_array_data;
3068 static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str;
3069 static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
3070 static PyObject *__pyx_n_s_unpack;
3071 static PyObject *__pyx_n_s_update;
3072 static PyObject *__pyx_n_s_updateDilationElements;
3073 static PyObject *__pyx_n_s_updateDistortionElements;
3074 static PyObject *__pyx_n_s_updateElementBarycenters;
3075 static PyObject *__pyx_n_s_updateElementBoundaryNormalsTetr;
3076 static PyObject *__pyx_n_s_updateElementBoundaryNormalsTria;
3077 static PyObject *__pyx_n_s_updateElementVolumesTetra;
3078 static PyObject *__pyx_n_s_updateElementVolumesTriangle;
3079 static PyObject *__pyx_n_s_updateInverseMeanRatioTriangleEl;
3080 static PyObject *__pyx_n_s_updateInverseMeanRatioTriangleNo;
3081 static PyObject *__pyx_n_s_variableNumbering_subdomain2glob;
3082 static PyObject *__pyx_n_s_variableOffsets_subdomain_owned;
3083 static PyObject *__pyx_n_s_variable_nb_local;
3084 static PyObject *__pyx_n_s_vectors;
3085 static PyObject *__pyx_n_s_x;
3086 static PyObject *__pyx_n_s_x2;
3087 static PyObject *__pyx_n_s_xi;
3088 static PyObject *__pyx_n_s_y;
3089 static PyObject *__pyx_n_s_y2;
3090 static PyObject *__pyx_n_s_z;
3091 static PyObject *__pyx_n_s_z2;
3092 static PyObject *__pyx_n_s_zeros;
3093 static PyObject *__pyx_n_s_zeros_like;
3094 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_smoothNodesLaplace(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_nodeArray_, __Pyx_memviewslice __pyx_v_nodeStarOffsets, __Pyx_memviewslice __pyx_v_nodeStarArray, __Pyx_memviewslice __pyx_v_nodeMaterialTypes, int __pyx_v_nNodes_owned, int __pyx_v_nd, bool __pyx_v_simultaneous, bool __pyx_v_smoothBoundaries, __Pyx_memviewslice __pyx_v_fixedNodesBoolArray, double __pyx_v_alpha); /* proto */
3095 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_2smoothNodesCentroid(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_nodeArray_, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_nodeMaterialTypes, __Pyx_memviewslice __pyx_v_elementBarycentersArray, __Pyx_memviewslice __pyx_v_elementVolumesArray, __Pyx_memviewslice __pyx_v_elementNodesArray, int __pyx_v_nNodes_owned, bool __pyx_v_simultaneous, bool __pyx_v_smoothBoundaries, __Pyx_memviewslice __pyx_v_fixedNodesBoolArray, double __pyx_v_alpha); /* proto */
3096 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_4updateDilationElements(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_elementDilationArray_, __Pyx_memviewslice __pyx_v_elementVolumeArray, __Pyx_memviewslice __pyx_v_elementVolumeTargetArray, int __pyx_v_nElements); /* proto */
3097 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_6getDilationElements(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_elementVolumeArray, __Pyx_memviewslice __pyx_v_elementVolumeTargetArray); /* proto */
3098 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_8updateDistortionElements(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_elementDistortionArray_, __Pyx_memviewslice __pyx_v_J_array, __Pyx_memviewslice __pyx_v_detJ_array, int __pyx_v_nd, int __pyx_v_nElements); /* proto */
3099 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_10getDistortionElements(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_J_array, __Pyx_memviewslice __pyx_v_detJ_array, int __pyx_v_nd); /* proto */
3100 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_12updateInverseMeanRatioTriangleElements(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_IMRElementsArray_, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementNodesArray, int __pyx_v_nElements); /* proto */
3101 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_14getInverseMeanRatioTriangleElements(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementNodesArray); /* proto */
3102 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_16updateInverseMeanRatioTriangleNodes(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_IMRNodesArray_, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementNodesArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_nodeElementsArray, int __pyx_v_nNodes, int __pyx_v_nElements, bool __pyx_v_el_average); /* proto */
3103 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_18getInverseMeanRatioTriangleNodes(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementNodesArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_nodeElementsArray, bool __pyx_v_el_average); /* proto */
3104 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_20getInverseMeanRatioSingleTriangle(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_node0, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementNodesArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_nodeElementsArray); /* proto */
3105 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_22smoothNodesQuality(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_distortion, __Pyx_memviewslice __pyx_v_dilation, __Pyx_memviewslice __pyx_v_nodeArray, int __pyx_v_nNodes_owned, __Pyx_memviewslice __pyx_v_nodeMaterialTypes, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_elementNodesArray, CYTHON_UNUSED bool __pyx_v_apply_directly); /* proto */
3106 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_24getLocalNearestNode(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coords, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_nodeStarOffsets, __Pyx_memviewslice __pyx_v_nodeStarArray, int __pyx_v_node); /* proto */
3107 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_26getLocalNearestElement(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coords, __Pyx_memviewslice __pyx_v_elementBarycentersArray, __Pyx_memviewslice __pyx_v_elementNeighborsArray, int __pyx_v_eN); /* proto */
3108 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_28getLocalNearestElementAroundNode(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coords, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_elementBarycentersArray, int __pyx_v_node); /* proto */
3109 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_30getLocalNearestElementIntersection(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coords, __Pyx_memviewslice __pyx_v_starting_coords, __Pyx_memviewslice __pyx_v_elementBoundaryNormalsArray, __Pyx_memviewslice __pyx_v_elementBoundariesArray, __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray, __Pyx_memviewslice __pyx_v_elementBoundaryElementsArray, __Pyx_memviewslice __pyx_v_exteriorElementBoundariesBoolArray, int __pyx_v_eN); /* proto */
3110 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_32getLocalElement(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_femSpace, PyObject *__pyx_v_coords, PyObject *__pyx_v_node); /* proto */
3111 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_34updateElementBoundaryNormalsTriangle(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_elementBoundaryNormalsArray_, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementBoundariesArray, __Pyx_memviewslice __pyx_v_elementBoundaryNodesArray, __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray, __Pyx_memviewslice __pyx_v_elementBarycentersArray, int __pyx_v_nElements); /* proto */
3112 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_36getElementBoundaryNormalsTriangle(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementBoundariesArray, __Pyx_memviewslice __pyx_v_elementBoundaryNodesArray, __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray, __Pyx_memviewslice __pyx_v_elementBarycentersArray); /* proto */
3113 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_38updateElementBoundaryNormalsTetra(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_elementBoundaryNormalsArray_, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementBoundariesArray, __Pyx_memviewslice __pyx_v_elementBoundaryNodesArray, __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray, __Pyx_memviewslice __pyx_v_elementBarycentersArray, int __pyx_v_nElements); /* proto */
3114 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_40getElementBoundaryNormalsTetra(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementBoundariesArray, __Pyx_memviewslice __pyx_v_elementBoundaryNodesArray, __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray, __Pyx_memviewslice __pyx_v_elementBarycentersArray); /* proto */
3115 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_42updateElementVolumesTriangle(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_elementVolumesArray_, __Pyx_memviewslice __pyx_v_elementNodesArray, __Pyx_memviewslice __pyx_v_nodeArray, int __pyx_v_nElements); /* proto */
3116 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_44getElementVolumeTriangle(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_nA, __Pyx_memviewslice __pyx_v_nB, __Pyx_memviewslice __pyx_v_nC); /* proto */
3117 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_46updateElementVolumesTetra(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_elementVolumesArray_, __Pyx_memviewslice __pyx_v_elementNodesArray, __Pyx_memviewslice __pyx_v_nodeArray, int __pyx_v_nElements); /* proto */
3118 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_48updateElementBarycenters(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_elementBarycentersArray_, __Pyx_memviewslice __pyx_v_elementNodesArray, __Pyx_memviewslice __pyx_v_nodeArray, int __pyx_v_nElements); /* proto */
3119 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_50getCornerNodesTriangle(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_nodeStarArray, __Pyx_memviewslice __pyx_v_nodeStarOffsets, __Pyx_memviewslice __pyx_v_nodeMaterialTypes, int __pyx_v_nNodes); /* proto */
3120 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_21getNonOwnedNodeValues_genexpr(PyObject *__pyx_self); /* proto */
3121 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_21getNonOwnedNodeValues_3genexpr(PyObject *__pyx_self); /* proto */
3122 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_52getNonOwnedNodeValues(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_args_, int __pyx_v_nNodes_owned, int __pyx_v_nNodes_global, __Pyx_memviewslice __pyx_v_nodeNumbering_subdomain2global, __Pyx_memviewslice __pyx_v_nodeOffsets_subdomain_owned); /* proto */
3123 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_54checkOwnedVariable(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_variable_nb_local, int __pyx_v_rank, int __pyx_v_nVariables_owned, __Pyx_memviewslice __pyx_v_variableNumbering_subdomain2global, __Pyx_memviewslice __pyx_v_variableOffsets_subdomain_owned); /* proto */
3124 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_56pyScalarRecoveryAtNodes(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_scalars, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets); /* proto */
3125 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_58pyScalarRecoveryAtNodesWeighted(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_scalars, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_detJ_array, int __pyx_v_nNodes); /* proto */
3126 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_60pyVectorRecoveryAtNodes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vectors, PyObject *__pyx_v_nodeElementsArray, PyObject *__pyx_v_nodeElementOffsets, PyObject *__pyx_v_nd); /* proto */
3127 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_62pyVectorRecoveryAtNodesWeighted(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_vectors, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_detJ_array, int __pyx_v_nd); /* proto */
3128 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
3129 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
3130 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */
3131 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
3132 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */
3133 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */
3134 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */
3135 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */
3136 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
3137 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /* proto */
3138 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */
3139 static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
3140 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
3141 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
3142 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
3143 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
3144 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object); /* proto */
3145 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3146 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
3147 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */
3148 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
3149 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3150 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3151 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3152 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3153 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3154 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3155 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3156 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3157 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3158 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3159 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3160 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3161 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3162 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3163 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3164 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3165 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3166 static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
3167 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
3168 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
3169 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
3170 static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
3171 static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
3172 static PyObject *__pyx_tp_new_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3173 static PyObject *__pyx_tp_new_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3174 static PyObject *__pyx_tp_new_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3175 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3176 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3177 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3178 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3179 static PyObject *__pyx_float_0_;
3180 static PyObject *__pyx_float_1_;
3181 static PyObject *__pyx_float_0_5;
3182 static PyObject *__pyx_int_0;
3183 static PyObject *__pyx_int_1;
3184 static PyObject *__pyx_int_2;
3185 static PyObject *__pyx_int_3;
3186 static PyObject *__pyx_int_4;
3187 static PyObject *__pyx_int_184977713;
3188 static PyObject *__pyx_int_neg_1;
3189 static __Pyx_memviewslice __pyx_k_;
3190 static __Pyx_memviewslice __pyx_k__2;
3191 static __Pyx_memviewslice __pyx_k__5;
3192 static PyObject *__pyx_slice__4;
3193 static PyObject *__pyx_tuple__3;
3194 static PyObject *__pyx_tuple__6;
3195 static PyObject *__pyx_tuple__7;
3196 static PyObject *__pyx_tuple__8;
3197 static PyObject *__pyx_tuple__9;
3198 static PyObject *__pyx_tuple__10;
3199 static PyObject *__pyx_tuple__11;
3200 static PyObject *__pyx_tuple__12;
3201 static PyObject *__pyx_tuple__13;
3202 static PyObject *__pyx_tuple__14;
3203 static PyObject *__pyx_tuple__15;
3204 static PyObject *__pyx_tuple__16;
3205 static PyObject *__pyx_tuple__17;
3206 static PyObject *__pyx_tuple__18;
3207 static PyObject *__pyx_tuple__19;
3208 static PyObject *__pyx_tuple__20;
3209 static PyObject *__pyx_tuple__21;
3210 static PyObject *__pyx_tuple__22;
3211 static PyObject *__pyx_tuple__23;
3212 static PyObject *__pyx_tuple__24;
3213 static PyObject *__pyx_tuple__25;
3214 static PyObject *__pyx_tuple__26;
3215 static PyObject *__pyx_tuple__27;
3216 static PyObject *__pyx_tuple__28;
3217 static PyObject *__pyx_tuple__29;
3218 static PyObject *__pyx_tuple__30;
3219 static PyObject *__pyx_tuple__36;
3220 static PyObject *__pyx_tuple__38;
3221 static PyObject *__pyx_tuple__40;
3222 static PyObject *__pyx_tuple__42;
3223 static PyObject *__pyx_tuple__44;
3224 static PyObject *__pyx_tuple__46;
3225 static PyObject *__pyx_tuple__48;
3226 static PyObject *__pyx_tuple__50;
3227 static PyObject *__pyx_tuple__52;
3228 static PyObject *__pyx_tuple__54;
3229 static PyObject *__pyx_tuple__56;
3230 static PyObject *__pyx_tuple__58;
3231 static PyObject *__pyx_tuple__60;
3232 static PyObject *__pyx_tuple__62;
3233 static PyObject *__pyx_tuple__64;
3234 static PyObject *__pyx_tuple__66;
3235 static PyObject *__pyx_tuple__68;
3236 static PyObject *__pyx_tuple__70;
3237 static PyObject *__pyx_tuple__72;
3238 static PyObject *__pyx_tuple__74;
3239 static PyObject *__pyx_tuple__76;
3240 static PyObject *__pyx_tuple__78;
3241 static PyObject *__pyx_tuple__80;
3242 static PyObject *__pyx_tuple__82;
3243 static PyObject *__pyx_tuple__84;
3244 static PyObject *__pyx_tuple__86;
3245 static PyObject *__pyx_tuple__88;
3246 static PyObject *__pyx_tuple__90;
3247 static PyObject *__pyx_tuple__92;
3248 static PyObject *__pyx_tuple__94;
3249 static PyObject *__pyx_tuple__96;
3250 static PyObject *__pyx_tuple__98;
3251 static PyObject *__pyx_tuple__100;
3252 static PyObject *__pyx_tuple__101;
3253 static PyObject *__pyx_tuple__102;
3254 static PyObject *__pyx_tuple__103;
3255 static PyObject *__pyx_tuple__104;
3256 static PyObject *__pyx_tuple__105;
3257 static PyObject *__pyx_codeobj__37;
3258 static PyObject *__pyx_codeobj__39;
3259 static PyObject *__pyx_codeobj__41;
3260 static PyObject *__pyx_codeobj__43;
3261 static PyObject *__pyx_codeobj__45;
3262 static PyObject *__pyx_codeobj__47;
3263 static PyObject *__pyx_codeobj__49;
3264 static PyObject *__pyx_codeobj__51;
3265 static PyObject *__pyx_codeobj__53;
3266 static PyObject *__pyx_codeobj__55;
3267 static PyObject *__pyx_codeobj__57;
3268 static PyObject *__pyx_codeobj__59;
3269 static PyObject *__pyx_codeobj__61;
3270 static PyObject *__pyx_codeobj__63;
3271 static PyObject *__pyx_codeobj__65;
3272 static PyObject *__pyx_codeobj__67;
3273 static PyObject *__pyx_codeobj__69;
3274 static PyObject *__pyx_codeobj__71;
3275 static PyObject *__pyx_codeobj__73;
3276 static PyObject *__pyx_codeobj__75;
3277 static PyObject *__pyx_codeobj__77;
3278 static PyObject *__pyx_codeobj__79;
3279 static PyObject *__pyx_codeobj__81;
3280 static PyObject *__pyx_codeobj__83;
3281 static PyObject *__pyx_codeobj__85;
3282 static PyObject *__pyx_codeobj__87;
3283 static PyObject *__pyx_codeobj__89;
3284 static PyObject *__pyx_codeobj__91;
3285 static PyObject *__pyx_codeobj__93;
3286 static PyObject *__pyx_codeobj__95;
3287 static PyObject *__pyx_codeobj__97;
3288 static PyObject *__pyx_codeobj__99;
3289 static PyObject *__pyx_codeobj__106;
3290 /* Late includes */
3291 
3292 /* "mprans/MeshSmoothing.pyx":11
3293  * from proteus.Profiling import logEvent
3294  *
3295  * def smoothNodesLaplace(double[:,:] nodeArray_, # <<<<<<<<<<<<<<
3296  * int[:] nodeStarOffsets,
3297  * int[:] nodeStarArray,
3298  */
3299 
3300 /* Python wrapper */
3301 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_1smoothNodesLaplace(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3302 static char __pyx_doc_6mprans_13MeshSmoothing_smoothNodesLaplace[] = "\n Laplace Smoothing:\n Mesh nodes are displaced to the centroid of neighbouring nodes\n\n Parameters\n ----------\n nodeArray_: double[:,:]\n array of mesh nodes\n (!) will be modified with smoothing\n nodeStarOffsets: int[:]\n array to get offsets for neighbouring node numbers\n nodeStarArray: int[:]\n array of neighbouring nodes\n nodeMaterialTypes: int[:]\n array to know which node is interior node (materialType=0)\n nNodes_owned: int\n number of nodes owned\n nd: int\n number of dimensions (needed to find direction to smooth boundaries)\n simultaneous: bool\n if True: simultaneous smoothing\n if False: sequential smoothing\n smoothBoundaries: bool\n if True: boundaries are smoothed (only with surrounding boundary nodes)\n if False: boudnary nodes are fixed\n fixedNodesBoolArray: int[:]\n array of same length as nodeArray with:\n fixedNodesBoolArray[node] = 1 -> node is fixed\n fixedNodesBoolArray[node] = 0 -> node is not fixed\n alpha: double\n penalty term related to original position of nodes (0 <= alpha <= 1)\n ";
3303 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_1smoothNodesLaplace = {"smoothNodesLaplace", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_1smoothNodesLaplace, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mprans_13MeshSmoothing_smoothNodesLaplace};
3304 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_1smoothNodesLaplace(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3305  __Pyx_memviewslice __pyx_v_nodeArray_ = { 0, 0, { 0 }, { 0 }, { 0 } };
3306  __Pyx_memviewslice __pyx_v_nodeStarOffsets = { 0, 0, { 0 }, { 0 }, { 0 } };
3307  __Pyx_memviewslice __pyx_v_nodeStarArray = { 0, 0, { 0 }, { 0 }, { 0 } };
3308  __Pyx_memviewslice __pyx_v_nodeMaterialTypes = { 0, 0, { 0 }, { 0 }, { 0 } };
3309  int __pyx_v_nNodes_owned;
3310  int __pyx_v_nd;
3311  bool __pyx_v_simultaneous;
3312  bool __pyx_v_smoothBoundaries;
3313  __Pyx_memviewslice __pyx_v_fixedNodesBoolArray = { 0, 0, { 0 }, { 0 }, { 0 } };
3314  double __pyx_v_alpha;
3315  PyObject *__pyx_r = 0;
3316  __Pyx_RefNannyDeclarations
3317  __Pyx_RefNannySetupContext("smoothNodesLaplace (wrapper)", 0);
3318  {
3319  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nodeArray,&__pyx_n_s_nodeStarOffsets,&__pyx_n_s_nodeStarArray,&__pyx_n_s_nodeMaterialTypes,&__pyx_n_s_nNodes_owned,&__pyx_n_s_nd,&__pyx_n_s_simultaneous,&__pyx_n_s_smoothBoundaries,&__pyx_n_s_fixedNodesBoolArray,&__pyx_n_s_alpha,0};
3320  PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};
3321  if (unlikely(__pyx_kwds)) {
3322  Py_ssize_t kw_args;
3323  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3324  switch (pos_args) {
3325  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
3326  CYTHON_FALLTHROUGH;
3327  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
3328  CYTHON_FALLTHROUGH;
3329  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
3330  CYTHON_FALLTHROUGH;
3331  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
3332  CYTHON_FALLTHROUGH;
3333  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
3334  CYTHON_FALLTHROUGH;
3335  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3336  CYTHON_FALLTHROUGH;
3337  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3338  CYTHON_FALLTHROUGH;
3339  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3340  CYTHON_FALLTHROUGH;
3341  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3342  CYTHON_FALLTHROUGH;
3343  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3344  CYTHON_FALLTHROUGH;
3345  case 0: break;
3346  default: goto __pyx_L5_argtuple_error;
3347  }
3348  kw_args = PyDict_Size(__pyx_kwds);
3349  switch (pos_args) {
3350  case 0:
3351  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeArray)) != 0)) kw_args--;
3352  else goto __pyx_L5_argtuple_error;
3353  CYTHON_FALLTHROUGH;
3354  case 1:
3355  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeStarOffsets)) != 0)) kw_args--;
3356  else {
3357  __Pyx_RaiseArgtupleInvalid("smoothNodesLaplace", 0, 6, 10, 1); __PYX_ERR(0, 11, __pyx_L3_error)
3358  }
3359  CYTHON_FALLTHROUGH;
3360  case 2:
3361  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeStarArray)) != 0)) kw_args--;
3362  else {
3363  __Pyx_RaiseArgtupleInvalid("smoothNodesLaplace", 0, 6, 10, 2); __PYX_ERR(0, 11, __pyx_L3_error)
3364  }
3365  CYTHON_FALLTHROUGH;
3366  case 3:
3367  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeMaterialTypes)) != 0)) kw_args--;
3368  else {
3369  __Pyx_RaiseArgtupleInvalid("smoothNodesLaplace", 0, 6, 10, 3); __PYX_ERR(0, 11, __pyx_L3_error)
3370  }
3371  CYTHON_FALLTHROUGH;
3372  case 4:
3373  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nNodes_owned)) != 0)) kw_args--;
3374  else {
3375  __Pyx_RaiseArgtupleInvalid("smoothNodesLaplace", 0, 6, 10, 4); __PYX_ERR(0, 11, __pyx_L3_error)
3376  }
3377  CYTHON_FALLTHROUGH;
3378  case 5:
3379  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
3380  else {
3381  __Pyx_RaiseArgtupleInvalid("smoothNodesLaplace", 0, 6, 10, 5); __PYX_ERR(0, 11, __pyx_L3_error)
3382  }
3383  CYTHON_FALLTHROUGH;
3384  case 6:
3385  if (kw_args > 0) {
3386  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_simultaneous);
3387  if (value) { values[6] = value; kw_args--; }
3388  }
3389  CYTHON_FALLTHROUGH;
3390  case 7:
3391  if (kw_args > 0) {
3392  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_smoothBoundaries);
3393  if (value) { values[7] = value; kw_args--; }
3394  }
3395  CYTHON_FALLTHROUGH;
3396  case 8:
3397  if (kw_args > 0) {
3398  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fixedNodesBoolArray);
3399  if (value) { values[8] = value; kw_args--; }
3400  }
3401  CYTHON_FALLTHROUGH;
3402  case 9:
3403  if (kw_args > 0) {
3404  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha);
3405  if (value) { values[9] = value; kw_args--; }
3406  }
3407  }
3408  if (unlikely(kw_args > 0)) {
3409  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "smoothNodesLaplace") < 0)) __PYX_ERR(0, 11, __pyx_L3_error)
3410  }
3411  } else {
3412  switch (PyTuple_GET_SIZE(__pyx_args)) {
3413  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
3414  CYTHON_FALLTHROUGH;
3415  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
3416  CYTHON_FALLTHROUGH;
3417  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
3418  CYTHON_FALLTHROUGH;
3419  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
3420  CYTHON_FALLTHROUGH;
3421  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
3422  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3423  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3424  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3425  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3426  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3427  break;
3428  default: goto __pyx_L5_argtuple_error;
3429  }
3430  }
3431  __pyx_v_nodeArray_ = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeArray_.memview)) __PYX_ERR(0, 11, __pyx_L3_error)
3432  __pyx_v_nodeStarOffsets = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeStarOffsets.memview)) __PYX_ERR(0, 12, __pyx_L3_error)
3433  __pyx_v_nodeStarArray = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeStarArray.memview)) __PYX_ERR(0, 13, __pyx_L3_error)
3434  __pyx_v_nodeMaterialTypes = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeMaterialTypes.memview)) __PYX_ERR(0, 14, __pyx_L3_error)
3435  __pyx_v_nNodes_owned = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_nNodes_owned == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 15, __pyx_L3_error)
3436  __pyx_v_nd = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 16, __pyx_L3_error)
3437  if (values[6]) {
3438  __pyx_v_simultaneous = __Pyx_PyObject_IsTrue(values[6]); if (unlikely((__pyx_v_simultaneous == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 17, __pyx_L3_error)
3439  } else {
3440 
3441  /* "mprans/MeshSmoothing.pyx":17
3442  * int nNodes_owned,
3443  * int nd,
3444  * bool simultaneous=False, # <<<<<<<<<<<<<<
3445  * bool smoothBoundaries=True,
3446  * int[:] fixedNodesBoolArray=None,
3447  */
3448  __pyx_v_simultaneous = ((bool)0);
3449  }
3450  if (values[7]) {
3451  __pyx_v_smoothBoundaries = __Pyx_PyObject_IsTrue(values[7]); if (unlikely((__pyx_v_smoothBoundaries == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 18, __pyx_L3_error)
3452  } else {
3453 
3454  /* "mprans/MeshSmoothing.pyx":18
3455  * int nd,
3456  * bool simultaneous=False,
3457  * bool smoothBoundaries=True, # <<<<<<<<<<<<<<
3458  * int[:] fixedNodesBoolArray=None,
3459  * double alpha=0.):
3460  */
3461  __pyx_v_smoothBoundaries = ((bool)1);
3462  }
3463  if (values[8]) {
3464  __pyx_v_fixedNodesBoolArray = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[8], PyBUF_WRITABLE); if (unlikely(!__pyx_v_fixedNodesBoolArray.memview)) __PYX_ERR(0, 19, __pyx_L3_error)
3465  } else {
3466  __pyx_v_fixedNodesBoolArray = __pyx_k_;
3467  __PYX_INC_MEMVIEW(&__pyx_v_fixedNodesBoolArray, 1);
3468  }
3469  if (values[9]) {
3470  __pyx_v_alpha = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 20, __pyx_L3_error)
3471  } else {
3472  __pyx_v_alpha = ((double)0.);
3473  }
3474  }
3475  goto __pyx_L4_argument_unpacking_done;
3476  __pyx_L5_argtuple_error:;
3477  __Pyx_RaiseArgtupleInvalid("smoothNodesLaplace", 0, 6, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 11, __pyx_L3_error)
3478  __pyx_L3_error:;
3479  __Pyx_AddTraceback("mprans.MeshSmoothing.smoothNodesLaplace", __pyx_clineno, __pyx_lineno, __pyx_filename);
3480  __Pyx_RefNannyFinishContext();
3481  return NULL;
3482  __pyx_L4_argument_unpacking_done:;
3483  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_smoothNodesLaplace(__pyx_self, __pyx_v_nodeArray_, __pyx_v_nodeStarOffsets, __pyx_v_nodeStarArray, __pyx_v_nodeMaterialTypes, __pyx_v_nNodes_owned, __pyx_v_nd, __pyx_v_simultaneous, __pyx_v_smoothBoundaries, __pyx_v_fixedNodesBoolArray, __pyx_v_alpha);
3484 
3485  /* "mprans/MeshSmoothing.pyx":11
3486  * from proteus.Profiling import logEvent
3487  *
3488  * def smoothNodesLaplace(double[:,:] nodeArray_, # <<<<<<<<<<<<<<
3489  * int[:] nodeStarOffsets,
3490  * int[:] nodeStarArray,
3491  */
3492 
3493  /* function exit code */
3494  __Pyx_RefNannyFinishContext();
3495  return __pyx_r;
3496 }
3497 
3498 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_smoothNodesLaplace(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_nodeArray_, __Pyx_memviewslice __pyx_v_nodeStarOffsets, __Pyx_memviewslice __pyx_v_nodeStarArray, __Pyx_memviewslice __pyx_v_nodeMaterialTypes, int __pyx_v_nNodes_owned, int __pyx_v_nd, bool __pyx_v_simultaneous, bool __pyx_v_smoothBoundaries, __Pyx_memviewslice __pyx_v_fixedNodesBoolArray, double __pyx_v_alpha) {
3499  PyObject *__pyx_r = NULL;
3500  __Pyx_RefNannyDeclarations
3501  struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesLaplace __pyx_t_1;
3502  __Pyx_RefNannySetupContext("smoothNodesLaplace", 0);
3503 
3504  /* "mprans/MeshSmoothing.pyx":53
3505  * penalty term related to original position of nodes (0 <= alpha <= 1)
3506  * """
3507  * cySmoothNodesLaplace(nodeArray_=nodeArray_, # <<<<<<<<<<<<<<
3508  * nodeStarOffsets=nodeStarOffsets,
3509  * nodeStarArray=nodeStarArray,
3510  */
3511  __pyx_t_1.__pyx_n = 4;
3512  __pyx_t_1.simultaneous = __pyx_v_simultaneous;
3513  __pyx_t_1.smoothBoundaries = __pyx_v_smoothBoundaries;
3514  __pyx_t_1.fixedNodesBoolArray = __pyx_v_fixedNodesBoolArray;
3515  __pyx_t_1.alpha = __pyx_v_alpha;
3516  __pyx_f_6mprans_13MeshSmoothing_cySmoothNodesLaplace(__pyx_v_nodeArray_, __pyx_v_nodeStarOffsets, __pyx_v_nodeStarArray, __pyx_v_nodeMaterialTypes, __pyx_v_nNodes_owned, __pyx_v_nd, &__pyx_t_1);
3517 
3518  /* "mprans/MeshSmoothing.pyx":11
3519  * from proteus.Profiling import logEvent
3520  *
3521  * def smoothNodesLaplace(double[:,:] nodeArray_, # <<<<<<<<<<<<<<
3522  * int[:] nodeStarOffsets,
3523  * int[:] nodeStarArray,
3524  */
3525 
3526  /* function exit code */
3527  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3528  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray_, 1);
3529  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeStarOffsets, 1);
3530  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeStarArray, 1);
3531  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeMaterialTypes, 1);
3532  __PYX_XDEC_MEMVIEW(&__pyx_v_fixedNodesBoolArray, 1);
3533  __Pyx_XGIVEREF(__pyx_r);
3534  __Pyx_RefNannyFinishContext();
3535  return __pyx_r;
3536 }
3537 
3538 /* "mprans/MeshSmoothing.pyx":64
3539  * alpha=alpha)
3540  *
3541  * def smoothNodesCentroid(double[:,:] nodeArray_, # <<<<<<<<<<<<<<
3542  * int[:] nodeElementOffsets,
3543  * int[:] nodeElementsArray,
3544  */
3545 
3546 /* Python wrapper */
3547 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_3smoothNodesCentroid(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3548 static char __pyx_doc_6mprans_13MeshSmoothing_2smoothNodesCentroid[] = "\n Centroid Smoothing:\n Mesh nodes are displaced to the centroid of the polygon/volume formed by\n neighbouring nodes\n\n Parameters\n ----------\n nodeArray_: double[:,:]\n array of mesh nodes\n (!) will be modified with smoothing\n nodeElementsOffsets: int[:]\n array to get offsets for neighbouring element numbers\n nodeElementsArray: int[:]\n array to get element number from nodeElementOffsets\n nodeMaterialTypes: int[:]\n array to know which node is interior node (materialType=0)\n elementBarycentersArray: double[:,:]\n barycenters of elements\n elementVolumesArray: double[:]\n volume of elements\n elementNodesArray: int[:,:]\n list of nodes per elements\n nNodes_owned: int\n number of nodes owned\n simultaneous: bool\n if True: simultaneous smoothing\n if False: sequential smoothing\n (!) will update areas/volumes and barycenters in this case\n smoothBoundaries: bool\n if True: boundaries are smoothed (only with surrounding boundary nodes)\n if False: boudnary nodes are fixed\n fixedNodesBoolArray: int[:]\n array of same length as nodeArray with:\n fixedNodesBoolArray[node] = 1 -> node is fixed\n fixedNodesBoolArray[node] = 0 -> node is not fixed\n alpha: double\n penalty term related to original position of nodes (0 <= alpha <= 1)\n ";
3549 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_3smoothNodesCentroid = {"smoothNodesCentroid", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_3smoothNodesCentroid, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mprans_13MeshSmoothing_2smoothNodesCentroid};
3550 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_3smoothNodesCentroid(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3551  __Pyx_memviewslice __pyx_v_nodeArray_ = { 0, 0, { 0 }, { 0 }, { 0 } };
3552  __Pyx_memviewslice __pyx_v_nodeElementOffsets = { 0, 0, { 0 }, { 0 }, { 0 } };
3553  __Pyx_memviewslice __pyx_v_nodeElementsArray = { 0, 0, { 0 }, { 0 }, { 0 } };
3554  __Pyx_memviewslice __pyx_v_nodeMaterialTypes = { 0, 0, { 0 }, { 0 }, { 0 } };
3555  __Pyx_memviewslice __pyx_v_elementBarycentersArray = { 0, 0, { 0 }, { 0 }, { 0 } };
3556  __Pyx_memviewslice __pyx_v_elementVolumesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
3557  __Pyx_memviewslice __pyx_v_elementNodesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
3558  int __pyx_v_nNodes_owned;
3559  bool __pyx_v_simultaneous;
3560  bool __pyx_v_smoothBoundaries;
3561  __Pyx_memviewslice __pyx_v_fixedNodesBoolArray = { 0, 0, { 0 }, { 0 }, { 0 } };
3562  double __pyx_v_alpha;
3563  PyObject *__pyx_r = 0;
3564  __Pyx_RefNannyDeclarations
3565  __Pyx_RefNannySetupContext("smoothNodesCentroid (wrapper)", 0);
3566  {
3567  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nodeArray,&__pyx_n_s_nodeElementOffsets,&__pyx_n_s_nodeElementsArray,&__pyx_n_s_nodeMaterialTypes,&__pyx_n_s_elementBarycentersArray,&__pyx_n_s_elementVolumesArray,&__pyx_n_s_elementNodesArray,&__pyx_n_s_nNodes_owned,&__pyx_n_s_simultaneous,&__pyx_n_s_smoothBoundaries,&__pyx_n_s_fixedNodesBoolArray,&__pyx_n_s_alpha,0};
3568  PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
3569  if (unlikely(__pyx_kwds)) {
3570  Py_ssize_t kw_args;
3571  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3572  switch (pos_args) {
3573  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
3574  CYTHON_FALLTHROUGH;
3575  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
3576  CYTHON_FALLTHROUGH;
3577  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
3578  CYTHON_FALLTHROUGH;
3579  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
3580  CYTHON_FALLTHROUGH;
3581  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
3582  CYTHON_FALLTHROUGH;
3583  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
3584  CYTHON_FALLTHROUGH;
3585  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
3586  CYTHON_FALLTHROUGH;
3587  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3588  CYTHON_FALLTHROUGH;
3589  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3590  CYTHON_FALLTHROUGH;
3591  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3592  CYTHON_FALLTHROUGH;
3593  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3594  CYTHON_FALLTHROUGH;
3595  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3596  CYTHON_FALLTHROUGH;
3597  case 0: break;
3598  default: goto __pyx_L5_argtuple_error;
3599  }
3600  kw_args = PyDict_Size(__pyx_kwds);
3601  switch (pos_args) {
3602  case 0:
3603  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeArray)) != 0)) kw_args--;
3604  else goto __pyx_L5_argtuple_error;
3605  CYTHON_FALLTHROUGH;
3606  case 1:
3607  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementOffsets)) != 0)) kw_args--;
3608  else {
3609  __Pyx_RaiseArgtupleInvalid("smoothNodesCentroid", 0, 8, 12, 1); __PYX_ERR(0, 64, __pyx_L3_error)
3610  }
3611  CYTHON_FALLTHROUGH;
3612  case 2:
3613  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementsArray)) != 0)) kw_args--;
3614  else {
3615  __Pyx_RaiseArgtupleInvalid("smoothNodesCentroid", 0, 8, 12, 2); __PYX_ERR(0, 64, __pyx_L3_error)
3616  }
3617  CYTHON_FALLTHROUGH;
3618  case 3:
3619  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeMaterialTypes)) != 0)) kw_args--;
3620  else {
3621  __Pyx_RaiseArgtupleInvalid("smoothNodesCentroid", 0, 8, 12, 3); __PYX_ERR(0, 64, __pyx_L3_error)
3622  }
3623  CYTHON_FALLTHROUGH;
3624  case 4:
3625  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
3626  else {
3627  __Pyx_RaiseArgtupleInvalid("smoothNodesCentroid", 0, 8, 12, 4); __PYX_ERR(0, 64, __pyx_L3_error)
3628  }
3629  CYTHON_FALLTHROUGH;
3630  case 5:
3631  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementVolumesArray)) != 0)) kw_args--;
3632  else {
3633  __Pyx_RaiseArgtupleInvalid("smoothNodesCentroid", 0, 8, 12, 5); __PYX_ERR(0, 64, __pyx_L3_error)
3634  }
3635  CYTHON_FALLTHROUGH;
3636  case 6:
3637  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNodesArray)) != 0)) kw_args--;
3638  else {
3639  __Pyx_RaiseArgtupleInvalid("smoothNodesCentroid", 0, 8, 12, 6); __PYX_ERR(0, 64, __pyx_L3_error)
3640  }
3641  CYTHON_FALLTHROUGH;
3642  case 7:
3643  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nNodes_owned)) != 0)) kw_args--;
3644  else {
3645  __Pyx_RaiseArgtupleInvalid("smoothNodesCentroid", 0, 8, 12, 7); __PYX_ERR(0, 64, __pyx_L3_error)
3646  }
3647  CYTHON_FALLTHROUGH;
3648  case 8:
3649  if (kw_args > 0) {
3650  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_simultaneous);
3651  if (value) { values[8] = value; kw_args--; }
3652  }
3653  CYTHON_FALLTHROUGH;
3654  case 9:
3655  if (kw_args > 0) {
3656  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_smoothBoundaries);
3657  if (value) { values[9] = value; kw_args--; }
3658  }
3659  CYTHON_FALLTHROUGH;
3660  case 10:
3661  if (kw_args > 0) {
3662  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fixedNodesBoolArray);
3663  if (value) { values[10] = value; kw_args--; }
3664  }
3665  CYTHON_FALLTHROUGH;
3666  case 11:
3667  if (kw_args > 0) {
3668  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha);
3669  if (value) { values[11] = value; kw_args--; }
3670  }
3671  }
3672  if (unlikely(kw_args > 0)) {
3673  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "smoothNodesCentroid") < 0)) __PYX_ERR(0, 64, __pyx_L3_error)
3674  }
3675  } else {
3676  switch (PyTuple_GET_SIZE(__pyx_args)) {
3677  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
3678  CYTHON_FALLTHROUGH;
3679  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
3680  CYTHON_FALLTHROUGH;
3681  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
3682  CYTHON_FALLTHROUGH;
3683  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
3684  CYTHON_FALLTHROUGH;
3685  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
3686  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
3687  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
3688  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3689  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3690  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3691  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3692  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3693  break;
3694  default: goto __pyx_L5_argtuple_error;
3695  }
3696  }
3697  __pyx_v_nodeArray_ = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeArray_.memview)) __PYX_ERR(0, 64, __pyx_L3_error)
3698  __pyx_v_nodeElementOffsets = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementOffsets.memview)) __PYX_ERR(0, 65, __pyx_L3_error)
3699  __pyx_v_nodeElementsArray = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementsArray.memview)) __PYX_ERR(0, 66, __pyx_L3_error)
3700  __pyx_v_nodeMaterialTypes = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeMaterialTypes.memview)) __PYX_ERR(0, 67, __pyx_L3_error)
3701  __pyx_v_elementBarycentersArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBarycentersArray.memview)) __PYX_ERR(0, 68, __pyx_L3_error)
3702  __pyx_v_elementVolumesArray = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementVolumesArray.memview)) __PYX_ERR(0, 69, __pyx_L3_error)
3703  __pyx_v_elementNodesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementNodesArray.memview)) __PYX_ERR(0, 70, __pyx_L3_error)
3704  __pyx_v_nNodes_owned = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_nNodes_owned == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 71, __pyx_L3_error)
3705  if (values[8]) {
3706  __pyx_v_simultaneous = __Pyx_PyObject_IsTrue(values[8]); if (unlikely((__pyx_v_simultaneous == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 72, __pyx_L3_error)
3707  } else {
3708 
3709  /* "mprans/MeshSmoothing.pyx":72
3710  * int[:,:] elementNodesArray,
3711  * int nNodes_owned,
3712  * bool simultaneous=True, # <<<<<<<<<<<<<<
3713  * bool smoothBoundaries=True,
3714  * int[:] fixedNodesBoolArray=None,
3715  */
3716  __pyx_v_simultaneous = ((bool)1);
3717  }
3718  if (values[9]) {
3719  __pyx_v_smoothBoundaries = __Pyx_PyObject_IsTrue(values[9]); if (unlikely((__pyx_v_smoothBoundaries == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 73, __pyx_L3_error)
3720  } else {
3721 
3722  /* "mprans/MeshSmoothing.pyx":73
3723  * int nNodes_owned,
3724  * bool simultaneous=True,
3725  * bool smoothBoundaries=True, # <<<<<<<<<<<<<<
3726  * int[:] fixedNodesBoolArray=None,
3727  * double alpha=0.):
3728  */
3729  __pyx_v_smoothBoundaries = ((bool)1);
3730  }
3731  if (values[10]) {
3732  __pyx_v_fixedNodesBoolArray = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[10], PyBUF_WRITABLE); if (unlikely(!__pyx_v_fixedNodesBoolArray.memview)) __PYX_ERR(0, 74, __pyx_L3_error)
3733  } else {
3734  __pyx_v_fixedNodesBoolArray = __pyx_k__2;
3735  __PYX_INC_MEMVIEW(&__pyx_v_fixedNodesBoolArray, 1);
3736  }
3737  if (values[11]) {
3738  __pyx_v_alpha = __pyx_PyFloat_AsDouble(values[11]); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 75, __pyx_L3_error)
3739  } else {
3740  __pyx_v_alpha = ((double)0.);
3741  }
3742  }
3743  goto __pyx_L4_argument_unpacking_done;
3744  __pyx_L5_argtuple_error:;
3745  __Pyx_RaiseArgtupleInvalid("smoothNodesCentroid", 0, 8, 12, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 64, __pyx_L3_error)
3746  __pyx_L3_error:;
3747  __Pyx_AddTraceback("mprans.MeshSmoothing.smoothNodesCentroid", __pyx_clineno, __pyx_lineno, __pyx_filename);
3748  __Pyx_RefNannyFinishContext();
3749  return NULL;
3750  __pyx_L4_argument_unpacking_done:;
3751  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_2smoothNodesCentroid(__pyx_self, __pyx_v_nodeArray_, __pyx_v_nodeElementOffsets, __pyx_v_nodeElementsArray, __pyx_v_nodeMaterialTypes, __pyx_v_elementBarycentersArray, __pyx_v_elementVolumesArray, __pyx_v_elementNodesArray, __pyx_v_nNodes_owned, __pyx_v_simultaneous, __pyx_v_smoothBoundaries, __pyx_v_fixedNodesBoolArray, __pyx_v_alpha);
3752 
3753  /* "mprans/MeshSmoothing.pyx":64
3754  * alpha=alpha)
3755  *
3756  * def smoothNodesCentroid(double[:,:] nodeArray_, # <<<<<<<<<<<<<<
3757  * int[:] nodeElementOffsets,
3758  * int[:] nodeElementsArray,
3759  */
3760 
3761  /* function exit code */
3762  __Pyx_RefNannyFinishContext();
3763  return __pyx_r;
3764 }
3765 
3766 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_2smoothNodesCentroid(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_nodeArray_, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_nodeMaterialTypes, __Pyx_memviewslice __pyx_v_elementBarycentersArray, __Pyx_memviewslice __pyx_v_elementVolumesArray, __Pyx_memviewslice __pyx_v_elementNodesArray, int __pyx_v_nNodes_owned, bool __pyx_v_simultaneous, bool __pyx_v_smoothBoundaries, __Pyx_memviewslice __pyx_v_fixedNodesBoolArray, double __pyx_v_alpha) {
3767  PyObject *__pyx_r = NULL;
3768  __Pyx_RefNannyDeclarations
3769  struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesCentroid __pyx_t_1;
3770  __Pyx_RefNannySetupContext("smoothNodesCentroid", 0);
3771 
3772  /* "mprans/MeshSmoothing.pyx":114
3773  * penalty term related to original position of nodes (0 <= alpha <= 1)
3774  * """
3775  * cySmoothNodesCentroid(nodeArray_=nodeArray_, # <<<<<<<<<<<<<<
3776  * nodeElementOffsets=nodeElementOffsets,
3777  * nodeElementsArray=nodeElementsArray,
3778  */
3779  __pyx_t_1.__pyx_n = 3;
3780  __pyx_t_1.simultaneous = __pyx_v_simultaneous;
3781  __pyx_t_1.smoothBoundaries = __pyx_v_smoothBoundaries;
3782  __pyx_t_1.alpha = __pyx_v_alpha;
3783  __pyx_f_6mprans_13MeshSmoothing_cySmoothNodesCentroid(__pyx_v_nodeArray_, __pyx_v_nodeElementOffsets, __pyx_v_nodeElementsArray, __pyx_v_nodeMaterialTypes, __pyx_v_elementVolumesArray, __pyx_v_elementBarycentersArray, __pyx_v_elementNodesArray, __pyx_v_nNodes_owned, __pyx_v_fixedNodesBoolArray, &__pyx_t_1);
3784 
3785  /* "mprans/MeshSmoothing.pyx":64
3786  * alpha=alpha)
3787  *
3788  * def smoothNodesCentroid(double[:,:] nodeArray_, # <<<<<<<<<<<<<<
3789  * int[:] nodeElementOffsets,
3790  * int[:] nodeElementsArray,
3791  */
3792 
3793  /* function exit code */
3794  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3795  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray_, 1);
3796  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementOffsets, 1);
3797  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementsArray, 1);
3798  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeMaterialTypes, 1);
3799  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBarycentersArray, 1);
3800  __PYX_XDEC_MEMVIEW(&__pyx_v_elementVolumesArray, 1);
3801  __PYX_XDEC_MEMVIEW(&__pyx_v_elementNodesArray, 1);
3802  __PYX_XDEC_MEMVIEW(&__pyx_v_fixedNodesBoolArray, 1);
3803  __Pyx_XGIVEREF(__pyx_r);
3804  __Pyx_RefNannyFinishContext();
3805  return __pyx_r;
3806 }
3807 
3808 /* "mprans/MeshSmoothing.pyx":127
3809  * alpha=alpha)
3810  *
3811  * def updateDilationElements(double[:] elementDilationArray_, # <<<<<<<<<<<<<<
3812  * double[:] elementVolumeArray,
3813  * double[:] elementVolumeTargetArray,
3814  */
3815 
3816 /* Python wrapper */
3817 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_5updateDilationElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3818 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_5updateDilationElements = {"updateDilationElements", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_5updateDilationElements, METH_VARARGS|METH_KEYWORDS, 0};
3819 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_5updateDilationElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3820  __Pyx_memviewslice __pyx_v_elementDilationArray_ = { 0, 0, { 0 }, { 0 }, { 0 } };
3821  __Pyx_memviewslice __pyx_v_elementVolumeArray = { 0, 0, { 0 }, { 0 }, { 0 } };
3822  __Pyx_memviewslice __pyx_v_elementVolumeTargetArray = { 0, 0, { 0 }, { 0 }, { 0 } };
3823  int __pyx_v_nElements;
3824  PyObject *__pyx_r = 0;
3825  __Pyx_RefNannyDeclarations
3826  __Pyx_RefNannySetupContext("updateDilationElements (wrapper)", 0);
3827  {
3828  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementDilationArray,&__pyx_n_s_elementVolumeArray,&__pyx_n_s_elementVolumeTargetArray,&__pyx_n_s_nElements,0};
3829  PyObject* values[4] = {0,0,0,0};
3830  if (unlikely(__pyx_kwds)) {
3831  Py_ssize_t kw_args;
3832  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3833  switch (pos_args) {
3834  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3835  CYTHON_FALLTHROUGH;
3836  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3837  CYTHON_FALLTHROUGH;
3838  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3839  CYTHON_FALLTHROUGH;
3840  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3841  CYTHON_FALLTHROUGH;
3842  case 0: break;
3843  default: goto __pyx_L5_argtuple_error;
3844  }
3845  kw_args = PyDict_Size(__pyx_kwds);
3846  switch (pos_args) {
3847  case 0:
3848  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementDilationArray)) != 0)) kw_args--;
3849  else goto __pyx_L5_argtuple_error;
3850  CYTHON_FALLTHROUGH;
3851  case 1:
3852  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementVolumeArray)) != 0)) kw_args--;
3853  else {
3854  __Pyx_RaiseArgtupleInvalid("updateDilationElements", 1, 4, 4, 1); __PYX_ERR(0, 127, __pyx_L3_error)
3855  }
3856  CYTHON_FALLTHROUGH;
3857  case 2:
3858  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementVolumeTargetArray)) != 0)) kw_args--;
3859  else {
3860  __Pyx_RaiseArgtupleInvalid("updateDilationElements", 1, 4, 4, 2); __PYX_ERR(0, 127, __pyx_L3_error)
3861  }
3862  CYTHON_FALLTHROUGH;
3863  case 3:
3864  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements)) != 0)) kw_args--;
3865  else {
3866  __Pyx_RaiseArgtupleInvalid("updateDilationElements", 1, 4, 4, 3); __PYX_ERR(0, 127, __pyx_L3_error)
3867  }
3868  }
3869  if (unlikely(kw_args > 0)) {
3870  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "updateDilationElements") < 0)) __PYX_ERR(0, 127, __pyx_L3_error)
3871  }
3872  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
3873  goto __pyx_L5_argtuple_error;
3874  } else {
3875  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3876  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3877  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3878  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3879  }
3880  __pyx_v_elementDilationArray_ = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementDilationArray_.memview)) __PYX_ERR(0, 127, __pyx_L3_error)
3881  __pyx_v_elementVolumeArray = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementVolumeArray.memview)) __PYX_ERR(0, 128, __pyx_L3_error)
3882  __pyx_v_elementVolumeTargetArray = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementVolumeTargetArray.memview)) __PYX_ERR(0, 129, __pyx_L3_error)
3883  __pyx_v_nElements = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nElements == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 130, __pyx_L3_error)
3884  }
3885  goto __pyx_L4_argument_unpacking_done;
3886  __pyx_L5_argtuple_error:;
3887  __Pyx_RaiseArgtupleInvalid("updateDilationElements", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 127, __pyx_L3_error)
3888  __pyx_L3_error:;
3889  __Pyx_AddTraceback("mprans.MeshSmoothing.updateDilationElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
3890  __Pyx_RefNannyFinishContext();
3891  return NULL;
3892  __pyx_L4_argument_unpacking_done:;
3893  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_4updateDilationElements(__pyx_self, __pyx_v_elementDilationArray_, __pyx_v_elementVolumeArray, __pyx_v_elementVolumeTargetArray, __pyx_v_nElements);
3894 
3895  /* function exit code */
3896  __Pyx_RefNannyFinishContext();
3897  return __pyx_r;
3898 }
3899 
3900 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_4updateDilationElements(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_elementDilationArray_, __Pyx_memviewslice __pyx_v_elementVolumeArray, __Pyx_memviewslice __pyx_v_elementVolumeTargetArray, int __pyx_v_nElements) {
3901  PyObject *__pyx_r = NULL;
3902  __Pyx_RefNannyDeclarations
3903  __Pyx_RefNannySetupContext("updateDilationElements", 0);
3904 
3905  /* "mprans/MeshSmoothing.pyx":131
3906  * double[:] elementVolumeTargetArray,
3907  * int nElements):
3908  * cyUpdateDilationElements(elementDilationArray_=elementDilationArray_, # <<<<<<<<<<<<<<
3909  * elementVolumeArray=elementVolumeArray,
3910  * elementVolumeTargetArray=elementVolumeTargetArray,
3911  */
3912  __pyx_f_6mprans_13MeshSmoothing_cyUpdateDilationElements(__pyx_v_elementDilationArray_, __pyx_v_elementVolumeArray, __pyx_v_elementVolumeTargetArray, __pyx_v_nElements);
3913 
3914  /* "mprans/MeshSmoothing.pyx":127
3915  * alpha=alpha)
3916  *
3917  * def updateDilationElements(double[:] elementDilationArray_, # <<<<<<<<<<<<<<
3918  * double[:] elementVolumeArray,
3919  * double[:] elementVolumeTargetArray,
3920  */
3921 
3922  /* function exit code */
3923  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3924  __PYX_XDEC_MEMVIEW(&__pyx_v_elementDilationArray_, 1);
3925  __PYX_XDEC_MEMVIEW(&__pyx_v_elementVolumeArray, 1);
3926  __PYX_XDEC_MEMVIEW(&__pyx_v_elementVolumeTargetArray, 1);
3927  __Pyx_XGIVEREF(__pyx_r);
3928  __Pyx_RefNannyFinishContext();
3929  return __pyx_r;
3930 }
3931 
3932 /* "mprans/MeshSmoothing.pyx":136
3933  * nElements=nElements)
3934  *
3935  * def getDilationElements(double[:] elementVolumeArray, # <<<<<<<<<<<<<<
3936  * double[:] elementVolumeTargetArray):
3937  * cdef int nElements = len(elementVolumeArray)
3938  */
3939 
3940 /* Python wrapper */
3941 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_7getDilationElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3942 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_7getDilationElements = {"getDilationElements", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_7getDilationElements, METH_VARARGS|METH_KEYWORDS, 0};
3943 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_7getDilationElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3944  __Pyx_memviewslice __pyx_v_elementVolumeArray = { 0, 0, { 0 }, { 0 }, { 0 } };
3945  __Pyx_memviewslice __pyx_v_elementVolumeTargetArray = { 0, 0, { 0 }, { 0 }, { 0 } };
3946  PyObject *__pyx_r = 0;
3947  __Pyx_RefNannyDeclarations
3948  __Pyx_RefNannySetupContext("getDilationElements (wrapper)", 0);
3949  {
3950  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementVolumeArray,&__pyx_n_s_elementVolumeTargetArray,0};
3951  PyObject* values[2] = {0,0};
3952  if (unlikely(__pyx_kwds)) {
3953  Py_ssize_t kw_args;
3954  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3955  switch (pos_args) {
3956  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3957  CYTHON_FALLTHROUGH;
3958  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3959  CYTHON_FALLTHROUGH;
3960  case 0: break;
3961  default: goto __pyx_L5_argtuple_error;
3962  }
3963  kw_args = PyDict_Size(__pyx_kwds);
3964  switch (pos_args) {
3965  case 0:
3966  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementVolumeArray)) != 0)) kw_args--;
3967  else goto __pyx_L5_argtuple_error;
3968  CYTHON_FALLTHROUGH;
3969  case 1:
3970  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementVolumeTargetArray)) != 0)) kw_args--;
3971  else {
3972  __Pyx_RaiseArgtupleInvalid("getDilationElements", 1, 2, 2, 1); __PYX_ERR(0, 136, __pyx_L3_error)
3973  }
3974  }
3975  if (unlikely(kw_args > 0)) {
3976  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getDilationElements") < 0)) __PYX_ERR(0, 136, __pyx_L3_error)
3977  }
3978  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
3979  goto __pyx_L5_argtuple_error;
3980  } else {
3981  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3982  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3983  }
3984  __pyx_v_elementVolumeArray = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementVolumeArray.memview)) __PYX_ERR(0, 136, __pyx_L3_error)
3985  __pyx_v_elementVolumeTargetArray = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementVolumeTargetArray.memview)) __PYX_ERR(0, 137, __pyx_L3_error)
3986  }
3987  goto __pyx_L4_argument_unpacking_done;
3988  __pyx_L5_argtuple_error:;
3989  __Pyx_RaiseArgtupleInvalid("getDilationElements", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 136, __pyx_L3_error)
3990  __pyx_L3_error:;
3991  __Pyx_AddTraceback("mprans.MeshSmoothing.getDilationElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
3992  __Pyx_RefNannyFinishContext();
3993  return NULL;
3994  __pyx_L4_argument_unpacking_done:;
3995  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_6getDilationElements(__pyx_self, __pyx_v_elementVolumeArray, __pyx_v_elementVolumeTargetArray);
3996 
3997  /* function exit code */
3998  __Pyx_RefNannyFinishContext();
3999  return __pyx_r;
4000 }
4001 
4002 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_6getDilationElements(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_elementVolumeArray, __Pyx_memviewslice __pyx_v_elementVolumeTargetArray) {
4003  int __pyx_v_nElements;
4004  PyObject *__pyx_v_elementDilationArray_ = NULL;
4005  PyObject *__pyx_r = NULL;
4006  __Pyx_RefNannyDeclarations
4007  size_t __pyx_t_1;
4008  PyObject *__pyx_t_2 = NULL;
4009  PyObject *__pyx_t_3 = NULL;
4010  PyObject *__pyx_t_4 = NULL;
4011  PyObject *__pyx_t_5 = NULL;
4012  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
4013  __Pyx_RefNannySetupContext("getDilationElements", 0);
4014 
4015  /* "mprans/MeshSmoothing.pyx":138
4016  * def getDilationElements(double[:] elementVolumeArray,
4017  * double[:] elementVolumeTargetArray):
4018  * cdef int nElements = len(elementVolumeArray) # <<<<<<<<<<<<<<
4019  * elementDilationArray_ = np.zeros(nElements)
4020  * cyUpdateDilationElements(elementDilationArray_=elementDilationArray_,
4021  */
4022  __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_elementVolumeArray);
4023  __pyx_v_nElements = __pyx_t_1;
4024 
4025  /* "mprans/MeshSmoothing.pyx":139
4026  * double[:] elementVolumeTargetArray):
4027  * cdef int nElements = len(elementVolumeArray)
4028  * elementDilationArray_ = np.zeros(nElements) # <<<<<<<<<<<<<<
4029  * cyUpdateDilationElements(elementDilationArray_=elementDilationArray_,
4030  * elementVolumeArray=elementVolumeArray,
4031  */
4032  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 139, __pyx_L1_error)
4033  __Pyx_GOTREF(__pyx_t_3);
4034  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 139, __pyx_L1_error)
4035  __Pyx_GOTREF(__pyx_t_4);
4036  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4037  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nElements); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 139, __pyx_L1_error)
4038  __Pyx_GOTREF(__pyx_t_3);
4039  __pyx_t_5 = NULL;
4040  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
4041  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
4042  if (likely(__pyx_t_5)) {
4043  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
4044  __Pyx_INCREF(__pyx_t_5);
4045  __Pyx_INCREF(function);
4046  __Pyx_DECREF_SET(__pyx_t_4, function);
4047  }
4048  }
4049  __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
4050  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
4051  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4052  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __pyx_L1_error)
4053  __Pyx_GOTREF(__pyx_t_2);
4054  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4055  __pyx_v_elementDilationArray_ = __pyx_t_2;
4056  __pyx_t_2 = 0;
4057 
4058  /* "mprans/MeshSmoothing.pyx":140
4059  * cdef int nElements = len(elementVolumeArray)
4060  * elementDilationArray_ = np.zeros(nElements)
4061  * cyUpdateDilationElements(elementDilationArray_=elementDilationArray_, # <<<<<<<<<<<<<<
4062  * elementVolumeArray=elementVolumeArray,
4063  * elementVolumeTargetArray=elementVolumeTargetArray,
4064  */
4065  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_elementDilationArray_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 140, __pyx_L1_error)
4066 
4067  /* "mprans/MeshSmoothing.pyx":143
4068  * elementVolumeArray=elementVolumeArray,
4069  * elementVolumeTargetArray=elementVolumeTargetArray,
4070  * nElements=nElements) # <<<<<<<<<<<<<<
4071  * return elementDilationArray_
4072  *
4073  */
4074  __pyx_f_6mprans_13MeshSmoothing_cyUpdateDilationElements(__pyx_t_6, __pyx_v_elementVolumeArray, __pyx_v_elementVolumeTargetArray, __pyx_v_nElements);
4075  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
4076  __pyx_t_6.memview = NULL;
4077  __pyx_t_6.data = NULL;
4078 
4079  /* "mprans/MeshSmoothing.pyx":144
4080  * elementVolumeTargetArray=elementVolumeTargetArray,
4081  * nElements=nElements)
4082  * return elementDilationArray_ # <<<<<<<<<<<<<<
4083  *
4084  * def updateDistortionElements(double[:] elementDistortionArray_,
4085  */
4086  __Pyx_XDECREF(__pyx_r);
4087  __Pyx_INCREF(__pyx_v_elementDilationArray_);
4088  __pyx_r = __pyx_v_elementDilationArray_;
4089  goto __pyx_L0;
4090 
4091  /* "mprans/MeshSmoothing.pyx":136
4092  * nElements=nElements)
4093  *
4094  * def getDilationElements(double[:] elementVolumeArray, # <<<<<<<<<<<<<<
4095  * double[:] elementVolumeTargetArray):
4096  * cdef int nElements = len(elementVolumeArray)
4097  */
4098 
4099  /* function exit code */
4100  __pyx_L1_error:;
4101  __Pyx_XDECREF(__pyx_t_2);
4102  __Pyx_XDECREF(__pyx_t_3);
4103  __Pyx_XDECREF(__pyx_t_4);
4104  __Pyx_XDECREF(__pyx_t_5);
4105  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
4106  __Pyx_AddTraceback("mprans.MeshSmoothing.getDilationElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
4107  __pyx_r = NULL;
4108  __pyx_L0:;
4109  __Pyx_XDECREF(__pyx_v_elementDilationArray_);
4110  __PYX_XDEC_MEMVIEW(&__pyx_v_elementVolumeArray, 1);
4111  __PYX_XDEC_MEMVIEW(&__pyx_v_elementVolumeTargetArray, 1);
4112  __Pyx_XGIVEREF(__pyx_r);
4113  __Pyx_RefNannyFinishContext();
4114  return __pyx_r;
4115 }
4116 
4117 /* "mprans/MeshSmoothing.pyx":146
4118  * return elementDilationArray_
4119  *
4120  * def updateDistortionElements(double[:] elementDistortionArray_, # <<<<<<<<<<<<<<
4121  * double[:,:,:,:] J_array,
4122  * double[:,:] detJ_array,
4123  */
4124 
4125 /* Python wrapper */
4126 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_9updateDistortionElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4127 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_9updateDistortionElements = {"updateDistortionElements", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_9updateDistortionElements, METH_VARARGS|METH_KEYWORDS, 0};
4128 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_9updateDistortionElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4129  __Pyx_memviewslice __pyx_v_elementDistortionArray_ = { 0, 0, { 0 }, { 0 }, { 0 } };
4130  __Pyx_memviewslice __pyx_v_J_array = { 0, 0, { 0 }, { 0 }, { 0 } };
4131  __Pyx_memviewslice __pyx_v_detJ_array = { 0, 0, { 0 }, { 0 }, { 0 } };
4132  int __pyx_v_nd;
4133  int __pyx_v_nElements;
4134  PyObject *__pyx_r = 0;
4135  __Pyx_RefNannyDeclarations
4136  __Pyx_RefNannySetupContext("updateDistortionElements (wrapper)", 0);
4137  {
4138  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementDistortionArray,&__pyx_n_s_J_array,&__pyx_n_s_detJ_array,&__pyx_n_s_nd,&__pyx_n_s_nElements,0};
4139  PyObject* values[5] = {0,0,0,0,0};
4140  if (unlikely(__pyx_kwds)) {
4141  Py_ssize_t kw_args;
4142  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4143  switch (pos_args) {
4144  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4145  CYTHON_FALLTHROUGH;
4146  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4147  CYTHON_FALLTHROUGH;
4148  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4149  CYTHON_FALLTHROUGH;
4150  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4151  CYTHON_FALLTHROUGH;
4152  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4153  CYTHON_FALLTHROUGH;
4154  case 0: break;
4155  default: goto __pyx_L5_argtuple_error;
4156  }
4157  kw_args = PyDict_Size(__pyx_kwds);
4158  switch (pos_args) {
4159  case 0:
4160  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementDistortionArray)) != 0)) kw_args--;
4161  else goto __pyx_L5_argtuple_error;
4162  CYTHON_FALLTHROUGH;
4163  case 1:
4164  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_J_array)) != 0)) kw_args--;
4165  else {
4166  __Pyx_RaiseArgtupleInvalid("updateDistortionElements", 1, 5, 5, 1); __PYX_ERR(0, 146, __pyx_L3_error)
4167  }
4168  CYTHON_FALLTHROUGH;
4169  case 2:
4170  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_detJ_array)) != 0)) kw_args--;
4171  else {
4172  __Pyx_RaiseArgtupleInvalid("updateDistortionElements", 1, 5, 5, 2); __PYX_ERR(0, 146, __pyx_L3_error)
4173  }
4174  CYTHON_FALLTHROUGH;
4175  case 3:
4176  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
4177  else {
4178  __Pyx_RaiseArgtupleInvalid("updateDistortionElements", 1, 5, 5, 3); __PYX_ERR(0, 146, __pyx_L3_error)
4179  }
4180  CYTHON_FALLTHROUGH;
4181  case 4:
4182  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements)) != 0)) kw_args--;
4183  else {
4184  __Pyx_RaiseArgtupleInvalid("updateDistortionElements", 1, 5, 5, 4); __PYX_ERR(0, 146, __pyx_L3_error)
4185  }
4186  }
4187  if (unlikely(kw_args > 0)) {
4188  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "updateDistortionElements") < 0)) __PYX_ERR(0, 146, __pyx_L3_error)
4189  }
4190  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
4191  goto __pyx_L5_argtuple_error;
4192  } else {
4193  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4194  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4195  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4196  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4197  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4198  }
4199  __pyx_v_elementDistortionArray_ = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementDistortionArray_.memview)) __PYX_ERR(0, 146, __pyx_L3_error)
4200  __pyx_v_J_array = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_J_array.memview)) __PYX_ERR(0, 147, __pyx_L3_error)
4201  __pyx_v_detJ_array = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_detJ_array.memview)) __PYX_ERR(0, 148, __pyx_L3_error)
4202  __pyx_v_nd = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 149, __pyx_L3_error)
4203  __pyx_v_nElements = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_nElements == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 150, __pyx_L3_error)
4204  }
4205  goto __pyx_L4_argument_unpacking_done;
4206  __pyx_L5_argtuple_error:;
4207  __Pyx_RaiseArgtupleInvalid("updateDistortionElements", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 146, __pyx_L3_error)
4208  __pyx_L3_error:;
4209  __Pyx_AddTraceback("mprans.MeshSmoothing.updateDistortionElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
4210  __Pyx_RefNannyFinishContext();
4211  return NULL;
4212  __pyx_L4_argument_unpacking_done:;
4213  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_8updateDistortionElements(__pyx_self, __pyx_v_elementDistortionArray_, __pyx_v_J_array, __pyx_v_detJ_array, __pyx_v_nd, __pyx_v_nElements);
4214 
4215  /* function exit code */
4216  __Pyx_RefNannyFinishContext();
4217  return __pyx_r;
4218 }
4219 
4220 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_8updateDistortionElements(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_elementDistortionArray_, __Pyx_memviewslice __pyx_v_J_array, __Pyx_memviewslice __pyx_v_detJ_array, int __pyx_v_nd, int __pyx_v_nElements) {
4221  PyObject *__pyx_r = NULL;
4222  __Pyx_RefNannyDeclarations
4223  __Pyx_RefNannySetupContext("updateDistortionElements", 0);
4224 
4225  /* "mprans/MeshSmoothing.pyx":151
4226  * int nd,
4227  * int nElements):
4228  * cyUpdateDistortionElements(elementDistortionArray_=elementDistortionArray_, # <<<<<<<<<<<<<<
4229  * J_array=J_array,
4230  * detJ_array=detJ_array,
4231  */
4232  __pyx_f_6mprans_13MeshSmoothing_cyUpdateDistortionElements(__pyx_v_elementDistortionArray_, __pyx_v_J_array, __pyx_v_detJ_array, __pyx_v_nd, __pyx_v_nElements);
4233 
4234  /* "mprans/MeshSmoothing.pyx":146
4235  * return elementDilationArray_
4236  *
4237  * def updateDistortionElements(double[:] elementDistortionArray_, # <<<<<<<<<<<<<<
4238  * double[:,:,:,:] J_array,
4239  * double[:,:] detJ_array,
4240  */
4241 
4242  /* function exit code */
4243  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4244  __PYX_XDEC_MEMVIEW(&__pyx_v_elementDistortionArray_, 1);
4245  __PYX_XDEC_MEMVIEW(&__pyx_v_J_array, 1);
4246  __PYX_XDEC_MEMVIEW(&__pyx_v_detJ_array, 1);
4247  __Pyx_XGIVEREF(__pyx_r);
4248  __Pyx_RefNannyFinishContext();
4249  return __pyx_r;
4250 }
4251 
4252 /* "mprans/MeshSmoothing.pyx":157
4253  * nElements=nElements)
4254  *
4255  * def getDistortionElements(double[:,:,:,:] J_array, # <<<<<<<<<<<<<<
4256  * double[:,:] detJ_array,
4257  * int nd):
4258  */
4259 
4260 /* Python wrapper */
4261 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_11getDistortionElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4262 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_11getDistortionElements = {"getDistortionElements", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_11getDistortionElements, METH_VARARGS|METH_KEYWORDS, 0};
4263 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_11getDistortionElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4264  __Pyx_memviewslice __pyx_v_J_array = { 0, 0, { 0 }, { 0 }, { 0 } };
4265  __Pyx_memviewslice __pyx_v_detJ_array = { 0, 0, { 0 }, { 0 }, { 0 } };
4266  int __pyx_v_nd;
4267  PyObject *__pyx_r = 0;
4268  __Pyx_RefNannyDeclarations
4269  __Pyx_RefNannySetupContext("getDistortionElements (wrapper)", 0);
4270  {
4271  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_J_array,&__pyx_n_s_detJ_array,&__pyx_n_s_nd,0};
4272  PyObject* values[3] = {0,0,0};
4273  if (unlikely(__pyx_kwds)) {
4274  Py_ssize_t kw_args;
4275  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4276  switch (pos_args) {
4277  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4278  CYTHON_FALLTHROUGH;
4279  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4280  CYTHON_FALLTHROUGH;
4281  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4282  CYTHON_FALLTHROUGH;
4283  case 0: break;
4284  default: goto __pyx_L5_argtuple_error;
4285  }
4286  kw_args = PyDict_Size(__pyx_kwds);
4287  switch (pos_args) {
4288  case 0:
4289  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_J_array)) != 0)) kw_args--;
4290  else goto __pyx_L5_argtuple_error;
4291  CYTHON_FALLTHROUGH;
4292  case 1:
4293  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_detJ_array)) != 0)) kw_args--;
4294  else {
4295  __Pyx_RaiseArgtupleInvalid("getDistortionElements", 1, 3, 3, 1); __PYX_ERR(0, 157, __pyx_L3_error)
4296  }
4297  CYTHON_FALLTHROUGH;
4298  case 2:
4299  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
4300  else {
4301  __Pyx_RaiseArgtupleInvalid("getDistortionElements", 1, 3, 3, 2); __PYX_ERR(0, 157, __pyx_L3_error)
4302  }
4303  }
4304  if (unlikely(kw_args > 0)) {
4305  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getDistortionElements") < 0)) __PYX_ERR(0, 157, __pyx_L3_error)
4306  }
4307  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
4308  goto __pyx_L5_argtuple_error;
4309  } else {
4310  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4311  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4312  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4313  }
4314  __pyx_v_J_array = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_J_array.memview)) __PYX_ERR(0, 157, __pyx_L3_error)
4315  __pyx_v_detJ_array = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_detJ_array.memview)) __PYX_ERR(0, 158, __pyx_L3_error)
4316  __pyx_v_nd = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 159, __pyx_L3_error)
4317  }
4318  goto __pyx_L4_argument_unpacking_done;
4319  __pyx_L5_argtuple_error:;
4320  __Pyx_RaiseArgtupleInvalid("getDistortionElements", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 157, __pyx_L3_error)
4321  __pyx_L3_error:;
4322  __Pyx_AddTraceback("mprans.MeshSmoothing.getDistortionElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
4323  __Pyx_RefNannyFinishContext();
4324  return NULL;
4325  __pyx_L4_argument_unpacking_done:;
4326  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_10getDistortionElements(__pyx_self, __pyx_v_J_array, __pyx_v_detJ_array, __pyx_v_nd);
4327 
4328  /* function exit code */
4329  __Pyx_RefNannyFinishContext();
4330  return __pyx_r;
4331 }
4332 
4333 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_10getDistortionElements(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_J_array, __Pyx_memviewslice __pyx_v_detJ_array, int __pyx_v_nd) {
4334  Py_ssize_t __pyx_v_nElements;
4335  PyObject *__pyx_v_elementDistortionArray_ = NULL;
4336  PyObject *__pyx_r = NULL;
4337  __Pyx_RefNannyDeclarations
4338  size_t __pyx_t_1;
4339  PyObject *__pyx_t_2 = NULL;
4340  PyObject *__pyx_t_3 = NULL;
4341  PyObject *__pyx_t_4 = NULL;
4342  PyObject *__pyx_t_5 = NULL;
4343  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
4344  __Pyx_RefNannySetupContext("getDistortionElements", 0);
4345 
4346  /* "mprans/MeshSmoothing.pyx":160
4347  * double[:,:] detJ_array,
4348  * int nd):
4349  * nElements = len(detJ_array) # <<<<<<<<<<<<<<
4350  * elementDistortionArray_ = np.zeros(nElements)
4351  * cyUpdateDistortionElements(elementDistortionArray_=elementDistortionArray_,
4352  */
4353  __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_detJ_array);
4354  __pyx_v_nElements = __pyx_t_1;
4355 
4356  /* "mprans/MeshSmoothing.pyx":161
4357  * int nd):
4358  * nElements = len(detJ_array)
4359  * elementDistortionArray_ = np.zeros(nElements) # <<<<<<<<<<<<<<
4360  * cyUpdateDistortionElements(elementDistortionArray_=elementDistortionArray_,
4361  * J_array=J_array,
4362  */
4363  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 161, __pyx_L1_error)
4364  __Pyx_GOTREF(__pyx_t_3);
4365  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 161, __pyx_L1_error)
4366  __Pyx_GOTREF(__pyx_t_4);
4367  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4368  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_nElements); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 161, __pyx_L1_error)
4369  __Pyx_GOTREF(__pyx_t_3);
4370  __pyx_t_5 = NULL;
4371  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
4372  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
4373  if (likely(__pyx_t_5)) {
4374  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
4375  __Pyx_INCREF(__pyx_t_5);
4376  __Pyx_INCREF(function);
4377  __Pyx_DECREF_SET(__pyx_t_4, function);
4378  }
4379  }
4380  __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
4381  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
4382  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4383  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 161, __pyx_L1_error)
4384  __Pyx_GOTREF(__pyx_t_2);
4385  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4386  __pyx_v_elementDistortionArray_ = __pyx_t_2;
4387  __pyx_t_2 = 0;
4388 
4389  /* "mprans/MeshSmoothing.pyx":162
4390  * nElements = len(detJ_array)
4391  * elementDistortionArray_ = np.zeros(nElements)
4392  * cyUpdateDistortionElements(elementDistortionArray_=elementDistortionArray_, # <<<<<<<<<<<<<<
4393  * J_array=J_array,
4394  * detJ_array=detJ_array,
4395  */
4396  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_elementDistortionArray_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 162, __pyx_L1_error)
4397 
4398  /* "mprans/MeshSmoothing.pyx":166
4399  * detJ_array=detJ_array,
4400  * nd=nd,
4401  * nElements=nElements) # <<<<<<<<<<<<<<
4402  * return elementDistortionArray_
4403  *
4404  */
4405  __pyx_f_6mprans_13MeshSmoothing_cyUpdateDistortionElements(__pyx_t_6, __pyx_v_J_array, __pyx_v_detJ_array, __pyx_v_nd, __pyx_v_nElements);
4406  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
4407  __pyx_t_6.memview = NULL;
4408  __pyx_t_6.data = NULL;
4409 
4410  /* "mprans/MeshSmoothing.pyx":167
4411  * nd=nd,
4412  * nElements=nElements)
4413  * return elementDistortionArray_ # <<<<<<<<<<<<<<
4414  *
4415  * def updateInverseMeanRatioTriangleElements(double[:] IMRElementsArray_,
4416  */
4417  __Pyx_XDECREF(__pyx_r);
4418  __Pyx_INCREF(__pyx_v_elementDistortionArray_);
4419  __pyx_r = __pyx_v_elementDistortionArray_;
4420  goto __pyx_L0;
4421 
4422  /* "mprans/MeshSmoothing.pyx":157
4423  * nElements=nElements)
4424  *
4425  * def getDistortionElements(double[:,:,:,:] J_array, # <<<<<<<<<<<<<<
4426  * double[:,:] detJ_array,
4427  * int nd):
4428  */
4429 
4430  /* function exit code */
4431  __pyx_L1_error:;
4432  __Pyx_XDECREF(__pyx_t_2);
4433  __Pyx_XDECREF(__pyx_t_3);
4434  __Pyx_XDECREF(__pyx_t_4);
4435  __Pyx_XDECREF(__pyx_t_5);
4436  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
4437  __Pyx_AddTraceback("mprans.MeshSmoothing.getDistortionElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
4438  __pyx_r = NULL;
4439  __pyx_L0:;
4440  __Pyx_XDECREF(__pyx_v_elementDistortionArray_);
4441  __PYX_XDEC_MEMVIEW(&__pyx_v_J_array, 1);
4442  __PYX_XDEC_MEMVIEW(&__pyx_v_detJ_array, 1);
4443  __Pyx_XGIVEREF(__pyx_r);
4444  __Pyx_RefNannyFinishContext();
4445  return __pyx_r;
4446 }
4447 
4448 /* "mprans/MeshSmoothing.pyx":169
4449  * return elementDistortionArray_
4450  *
4451  * def updateInverseMeanRatioTriangleElements(double[:] IMRElementsArray_, # <<<<<<<<<<<<<<
4452  * double[:,:] nodeArray,
4453  * int[:,:] elementNodesArray,
4454  */
4455 
4456 /* Python wrapper */
4457 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_13updateInverseMeanRatioTriangleElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4458 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_13updateInverseMeanRatioTriangleElements = {"updateInverseMeanRatioTriangleElements", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_13updateInverseMeanRatioTriangleElements, METH_VARARGS|METH_KEYWORDS, 0};
4459 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_13updateInverseMeanRatioTriangleElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4460  __Pyx_memviewslice __pyx_v_IMRElementsArray_ = { 0, 0, { 0 }, { 0 }, { 0 } };
4461  __Pyx_memviewslice __pyx_v_nodeArray = { 0, 0, { 0 }, { 0 }, { 0 } };
4462  __Pyx_memviewslice __pyx_v_elementNodesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
4463  int __pyx_v_nElements;
4464  PyObject *__pyx_r = 0;
4465  __Pyx_RefNannyDeclarations
4466  __Pyx_RefNannySetupContext("updateInverseMeanRatioTriangleElements (wrapper)", 0);
4467  {
4468  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_IMRElementsArray,&__pyx_n_s_nodeArray_2,&__pyx_n_s_elementNodesArray,&__pyx_n_s_nElements,0};
4469  PyObject* values[4] = {0,0,0,0};
4470  if (unlikely(__pyx_kwds)) {
4471  Py_ssize_t kw_args;
4472  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4473  switch (pos_args) {
4474  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4475  CYTHON_FALLTHROUGH;
4476  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4477  CYTHON_FALLTHROUGH;
4478  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4479  CYTHON_FALLTHROUGH;
4480  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4481  CYTHON_FALLTHROUGH;
4482  case 0: break;
4483  default: goto __pyx_L5_argtuple_error;
4484  }
4485  kw_args = PyDict_Size(__pyx_kwds);
4486  switch (pos_args) {
4487  case 0:
4488  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_IMRElementsArray)) != 0)) kw_args--;
4489  else goto __pyx_L5_argtuple_error;
4490  CYTHON_FALLTHROUGH;
4491  case 1:
4492  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeArray_2)) != 0)) kw_args--;
4493  else {
4494  __Pyx_RaiseArgtupleInvalid("updateInverseMeanRatioTriangleElements", 1, 4, 4, 1); __PYX_ERR(0, 169, __pyx_L3_error)
4495  }
4496  CYTHON_FALLTHROUGH;
4497  case 2:
4498  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNodesArray)) != 0)) kw_args--;
4499  else {
4500  __Pyx_RaiseArgtupleInvalid("updateInverseMeanRatioTriangleElements", 1, 4, 4, 2); __PYX_ERR(0, 169, __pyx_L3_error)
4501  }
4502  CYTHON_FALLTHROUGH;
4503  case 3:
4504  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements)) != 0)) kw_args--;
4505  else {
4506  __Pyx_RaiseArgtupleInvalid("updateInverseMeanRatioTriangleElements", 1, 4, 4, 3); __PYX_ERR(0, 169, __pyx_L3_error)
4507  }
4508  }
4509  if (unlikely(kw_args > 0)) {
4510  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "updateInverseMeanRatioTriangleElements") < 0)) __PYX_ERR(0, 169, __pyx_L3_error)
4511  }
4512  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
4513  goto __pyx_L5_argtuple_error;
4514  } else {
4515  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4516  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4517  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4518  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4519  }
4520  __pyx_v_IMRElementsArray_ = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_IMRElementsArray_.memview)) __PYX_ERR(0, 169, __pyx_L3_error)
4521  __pyx_v_nodeArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeArray.memview)) __PYX_ERR(0, 170, __pyx_L3_error)
4522  __pyx_v_elementNodesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementNodesArray.memview)) __PYX_ERR(0, 171, __pyx_L3_error)
4523  __pyx_v_nElements = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nElements == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 172, __pyx_L3_error)
4524  }
4525  goto __pyx_L4_argument_unpacking_done;
4526  __pyx_L5_argtuple_error:;
4527  __Pyx_RaiseArgtupleInvalid("updateInverseMeanRatioTriangleElements", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 169, __pyx_L3_error)
4528  __pyx_L3_error:;
4529  __Pyx_AddTraceback("mprans.MeshSmoothing.updateInverseMeanRatioTriangleElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
4530  __Pyx_RefNannyFinishContext();
4531  return NULL;
4532  __pyx_L4_argument_unpacking_done:;
4533  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_12updateInverseMeanRatioTriangleElements(__pyx_self, __pyx_v_IMRElementsArray_, __pyx_v_nodeArray, __pyx_v_elementNodesArray, __pyx_v_nElements);
4534 
4535  /* function exit code */
4536  __Pyx_RefNannyFinishContext();
4537  return __pyx_r;
4538 }
4539 
4540 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_12updateInverseMeanRatioTriangleElements(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_IMRElementsArray_, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementNodesArray, int __pyx_v_nElements) {
4541  PyObject *__pyx_r = NULL;
4542  __Pyx_RefNannyDeclarations
4543  __Pyx_RefNannySetupContext("updateInverseMeanRatioTriangleElements", 0);
4544 
4545  /* "mprans/MeshSmoothing.pyx":173
4546  * int[:,:] elementNodesArray,
4547  * int nElements):
4548  * cyUpdateInverseMeanRatioTriangleElements(IMRElementsArray_=IMRElementsArray_, # <<<<<<<<<<<<<<
4549  * nodeArray=nodeArray,
4550  * elementNodesArray=elementNodesArray,
4551  */
4552  __pyx_f_6mprans_13MeshSmoothing_cyUpdateInverseMeanRatioTriangleElements(__pyx_v_IMRElementsArray_, __pyx_v_nodeArray, __pyx_v_elementNodesArray, __pyx_v_nElements);
4553 
4554  /* "mprans/MeshSmoothing.pyx":169
4555  * return elementDistortionArray_
4556  *
4557  * def updateInverseMeanRatioTriangleElements(double[:] IMRElementsArray_, # <<<<<<<<<<<<<<
4558  * double[:,:] nodeArray,
4559  * int[:,:] elementNodesArray,
4560  */
4561 
4562  /* function exit code */
4563  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4564  __PYX_XDEC_MEMVIEW(&__pyx_v_IMRElementsArray_, 1);
4565  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray, 1);
4566  __PYX_XDEC_MEMVIEW(&__pyx_v_elementNodesArray, 1);
4567  __Pyx_XGIVEREF(__pyx_r);
4568  __Pyx_RefNannyFinishContext();
4569  return __pyx_r;
4570 }
4571 
4572 /* "mprans/MeshSmoothing.pyx":178
4573  * nElements=nElements)
4574  *
4575  * def getInverseMeanRatioTriangleElements(double[:,:] nodeArray, # <<<<<<<<<<<<<<
4576  * int[:,:] elementNodesArray):
4577  * cdef int nElements = len(elementNodesArray)
4578  */
4579 
4580 /* Python wrapper */
4581 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_15getInverseMeanRatioTriangleElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4582 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_15getInverseMeanRatioTriangleElements = {"getInverseMeanRatioTriangleElements", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_15getInverseMeanRatioTriangleElements, METH_VARARGS|METH_KEYWORDS, 0};
4583 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_15getInverseMeanRatioTriangleElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4584  __Pyx_memviewslice __pyx_v_nodeArray = { 0, 0, { 0 }, { 0 }, { 0 } };
4585  __Pyx_memviewslice __pyx_v_elementNodesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
4586  PyObject *__pyx_r = 0;
4587  __Pyx_RefNannyDeclarations
4588  __Pyx_RefNannySetupContext("getInverseMeanRatioTriangleElements (wrapper)", 0);
4589  {
4590  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nodeArray_2,&__pyx_n_s_elementNodesArray,0};
4591  PyObject* values[2] = {0,0};
4592  if (unlikely(__pyx_kwds)) {
4593  Py_ssize_t kw_args;
4594  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4595  switch (pos_args) {
4596  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4597  CYTHON_FALLTHROUGH;
4598  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4599  CYTHON_FALLTHROUGH;
4600  case 0: break;
4601  default: goto __pyx_L5_argtuple_error;
4602  }
4603  kw_args = PyDict_Size(__pyx_kwds);
4604  switch (pos_args) {
4605  case 0:
4606  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeArray_2)) != 0)) kw_args--;
4607  else goto __pyx_L5_argtuple_error;
4608  CYTHON_FALLTHROUGH;
4609  case 1:
4610  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNodesArray)) != 0)) kw_args--;
4611  else {
4612  __Pyx_RaiseArgtupleInvalid("getInverseMeanRatioTriangleElements", 1, 2, 2, 1); __PYX_ERR(0, 178, __pyx_L3_error)
4613  }
4614  }
4615  if (unlikely(kw_args > 0)) {
4616  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getInverseMeanRatioTriangleElements") < 0)) __PYX_ERR(0, 178, __pyx_L3_error)
4617  }
4618  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
4619  goto __pyx_L5_argtuple_error;
4620  } else {
4621  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4622  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4623  }
4624  __pyx_v_nodeArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeArray.memview)) __PYX_ERR(0, 178, __pyx_L3_error)
4625  __pyx_v_elementNodesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementNodesArray.memview)) __PYX_ERR(0, 179, __pyx_L3_error)
4626  }
4627  goto __pyx_L4_argument_unpacking_done;
4628  __pyx_L5_argtuple_error:;
4629  __Pyx_RaiseArgtupleInvalid("getInverseMeanRatioTriangleElements", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 178, __pyx_L3_error)
4630  __pyx_L3_error:;
4631  __Pyx_AddTraceback("mprans.MeshSmoothing.getInverseMeanRatioTriangleElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
4632  __Pyx_RefNannyFinishContext();
4633  return NULL;
4634  __pyx_L4_argument_unpacking_done:;
4635  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_14getInverseMeanRatioTriangleElements(__pyx_self, __pyx_v_nodeArray, __pyx_v_elementNodesArray);
4636 
4637  /* function exit code */
4638  __Pyx_RefNannyFinishContext();
4639  return __pyx_r;
4640 }
4641 
4642 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_14getInverseMeanRatioTriangleElements(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementNodesArray) {
4643  int __pyx_v_nElements;
4644  PyObject *__pyx_v_IMRElementsArray_ = NULL;
4645  PyObject *__pyx_r = NULL;
4646  __Pyx_RefNannyDeclarations
4647  size_t __pyx_t_1;
4648  PyObject *__pyx_t_2 = NULL;
4649  PyObject *__pyx_t_3 = NULL;
4650  PyObject *__pyx_t_4 = NULL;
4651  PyObject *__pyx_t_5 = NULL;
4652  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
4653  __Pyx_RefNannySetupContext("getInverseMeanRatioTriangleElements", 0);
4654 
4655  /* "mprans/MeshSmoothing.pyx":180
4656  * def getInverseMeanRatioTriangleElements(double[:,:] nodeArray,
4657  * int[:,:] elementNodesArray):
4658  * cdef int nElements = len(elementNodesArray) # <<<<<<<<<<<<<<
4659  * IMRElementsArray_ = np.zeros(nElements)
4660  * cyUpdateInverseMeanRatioTriangleElements(IMRElementsArray_=IMRElementsArray_,
4661  */
4662  __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_elementNodesArray);
4663  __pyx_v_nElements = __pyx_t_1;
4664 
4665  /* "mprans/MeshSmoothing.pyx":181
4666  * int[:,:] elementNodesArray):
4667  * cdef int nElements = len(elementNodesArray)
4668  * IMRElementsArray_ = np.zeros(nElements) # <<<<<<<<<<<<<<
4669  * cyUpdateInverseMeanRatioTriangleElements(IMRElementsArray_=IMRElementsArray_,
4670  * nodeArray=nodeArray,
4671  */
4672  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 181, __pyx_L1_error)
4673  __Pyx_GOTREF(__pyx_t_3);
4674  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 181, __pyx_L1_error)
4675  __Pyx_GOTREF(__pyx_t_4);
4676  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4677  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nElements); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 181, __pyx_L1_error)
4678  __Pyx_GOTREF(__pyx_t_3);
4679  __pyx_t_5 = NULL;
4680  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
4681  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
4682  if (likely(__pyx_t_5)) {
4683  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
4684  __Pyx_INCREF(__pyx_t_5);
4685  __Pyx_INCREF(function);
4686  __Pyx_DECREF_SET(__pyx_t_4, function);
4687  }
4688  }
4689  __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
4690  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
4691  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4692  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 181, __pyx_L1_error)
4693  __Pyx_GOTREF(__pyx_t_2);
4694  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4695  __pyx_v_IMRElementsArray_ = __pyx_t_2;
4696  __pyx_t_2 = 0;
4697 
4698  /* "mprans/MeshSmoothing.pyx":182
4699  * cdef int nElements = len(elementNodesArray)
4700  * IMRElementsArray_ = np.zeros(nElements)
4701  * cyUpdateInverseMeanRatioTriangleElements(IMRElementsArray_=IMRElementsArray_, # <<<<<<<<<<<<<<
4702  * nodeArray=nodeArray,
4703  * elementNodesArray=elementNodesArray,
4704  */
4705  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_IMRElementsArray_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 182, __pyx_L1_error)
4706 
4707  /* "mprans/MeshSmoothing.pyx":185
4708  * nodeArray=nodeArray,
4709  * elementNodesArray=elementNodesArray,
4710  * nElements=nElements) # <<<<<<<<<<<<<<
4711  * return IMRElementsArray_
4712  *
4713  */
4714  __pyx_f_6mprans_13MeshSmoothing_cyUpdateInverseMeanRatioTriangleElements(__pyx_t_6, __pyx_v_nodeArray, __pyx_v_elementNodesArray, __pyx_v_nElements);
4715  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
4716  __pyx_t_6.memview = NULL;
4717  __pyx_t_6.data = NULL;
4718 
4719  /* "mprans/MeshSmoothing.pyx":186
4720  * elementNodesArray=elementNodesArray,
4721  * nElements=nElements)
4722  * return IMRElementsArray_ # <<<<<<<<<<<<<<
4723  *
4724  * def updateInverseMeanRatioTriangleNodes(double[:] IMRNodesArray_,
4725  */
4726  __Pyx_XDECREF(__pyx_r);
4727  __Pyx_INCREF(__pyx_v_IMRElementsArray_);
4728  __pyx_r = __pyx_v_IMRElementsArray_;
4729  goto __pyx_L0;
4730 
4731  /* "mprans/MeshSmoothing.pyx":178
4732  * nElements=nElements)
4733  *
4734  * def getInverseMeanRatioTriangleElements(double[:,:] nodeArray, # <<<<<<<<<<<<<<
4735  * int[:,:] elementNodesArray):
4736  * cdef int nElements = len(elementNodesArray)
4737  */
4738 
4739  /* function exit code */
4740  __pyx_L1_error:;
4741  __Pyx_XDECREF(__pyx_t_2);
4742  __Pyx_XDECREF(__pyx_t_3);
4743  __Pyx_XDECREF(__pyx_t_4);
4744  __Pyx_XDECREF(__pyx_t_5);
4745  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
4746  __Pyx_AddTraceback("mprans.MeshSmoothing.getInverseMeanRatioTriangleElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
4747  __pyx_r = NULL;
4748  __pyx_L0:;
4749  __Pyx_XDECREF(__pyx_v_IMRElementsArray_);
4750  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray, 1);
4751  __PYX_XDEC_MEMVIEW(&__pyx_v_elementNodesArray, 1);
4752  __Pyx_XGIVEREF(__pyx_r);
4753  __Pyx_RefNannyFinishContext();
4754  return __pyx_r;
4755 }
4756 
4757 /* "mprans/MeshSmoothing.pyx":188
4758  * return IMRElementsArray_
4759  *
4760  * def updateInverseMeanRatioTriangleNodes(double[:] IMRNodesArray_, # <<<<<<<<<<<<<<
4761  * double[:,:] nodeArray,
4762  * int[:,:] elementNodesArray,
4763  */
4764 
4765 /* Python wrapper */
4766 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_17updateInverseMeanRatioTriangleNodes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4767 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_17updateInverseMeanRatioTriangleNodes = {"updateInverseMeanRatioTriangleNodes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_17updateInverseMeanRatioTriangleNodes, METH_VARARGS|METH_KEYWORDS, 0};
4768 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_17updateInverseMeanRatioTriangleNodes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4769  __Pyx_memviewslice __pyx_v_IMRNodesArray_ = { 0, 0, { 0 }, { 0 }, { 0 } };
4770  __Pyx_memviewslice __pyx_v_nodeArray = { 0, 0, { 0 }, { 0 }, { 0 } };
4771  __Pyx_memviewslice __pyx_v_elementNodesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
4772  __Pyx_memviewslice __pyx_v_nodeElementOffsets = { 0, 0, { 0 }, { 0 }, { 0 } };
4773  __Pyx_memviewslice __pyx_v_nodeElementsArray = { 0, 0, { 0 }, { 0 }, { 0 } };
4774  int __pyx_v_nNodes;
4775  int __pyx_v_nElements;
4776  bool __pyx_v_el_average;
4777  PyObject *__pyx_r = 0;
4778  __Pyx_RefNannyDeclarations
4779  __Pyx_RefNannySetupContext("updateInverseMeanRatioTriangleNodes (wrapper)", 0);
4780  {
4781  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_IMRNodesArray,&__pyx_n_s_nodeArray_2,&__pyx_n_s_elementNodesArray,&__pyx_n_s_nodeElementOffsets,&__pyx_n_s_nodeElementsArray,&__pyx_n_s_nNodes,&__pyx_n_s_nElements,&__pyx_n_s_el_average,0};
4782  PyObject* values[8] = {0,0,0,0,0,0,0,0};
4783  if (unlikely(__pyx_kwds)) {
4784  Py_ssize_t kw_args;
4785  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4786  switch (pos_args) {
4787  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
4788  CYTHON_FALLTHROUGH;
4789  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
4790  CYTHON_FALLTHROUGH;
4791  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
4792  CYTHON_FALLTHROUGH;
4793  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4794  CYTHON_FALLTHROUGH;
4795  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4796  CYTHON_FALLTHROUGH;
4797  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4798  CYTHON_FALLTHROUGH;
4799  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4800  CYTHON_FALLTHROUGH;
4801  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4802  CYTHON_FALLTHROUGH;
4803  case 0: break;
4804  default: goto __pyx_L5_argtuple_error;
4805  }
4806  kw_args = PyDict_Size(__pyx_kwds);
4807  switch (pos_args) {
4808  case 0:
4809  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_IMRNodesArray)) != 0)) kw_args--;
4810  else goto __pyx_L5_argtuple_error;
4811  CYTHON_FALLTHROUGH;
4812  case 1:
4813  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeArray_2)) != 0)) kw_args--;
4814  else {
4815  __Pyx_RaiseArgtupleInvalid("updateInverseMeanRatioTriangleNodes", 0, 7, 8, 1); __PYX_ERR(0, 188, __pyx_L3_error)
4816  }
4817  CYTHON_FALLTHROUGH;
4818  case 2:
4819  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNodesArray)) != 0)) kw_args--;
4820  else {
4821  __Pyx_RaiseArgtupleInvalid("updateInverseMeanRatioTriangleNodes", 0, 7, 8, 2); __PYX_ERR(0, 188, __pyx_L3_error)
4822  }
4823  CYTHON_FALLTHROUGH;
4824  case 3:
4825  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementOffsets)) != 0)) kw_args--;
4826  else {
4827  __Pyx_RaiseArgtupleInvalid("updateInverseMeanRatioTriangleNodes", 0, 7, 8, 3); __PYX_ERR(0, 188, __pyx_L3_error)
4828  }
4829  CYTHON_FALLTHROUGH;
4830  case 4:
4831  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementsArray)) != 0)) kw_args--;
4832  else {
4833  __Pyx_RaiseArgtupleInvalid("updateInverseMeanRatioTriangleNodes", 0, 7, 8, 4); __PYX_ERR(0, 188, __pyx_L3_error)
4834  }
4835  CYTHON_FALLTHROUGH;
4836  case 5:
4837  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nNodes)) != 0)) kw_args--;
4838  else {
4839  __Pyx_RaiseArgtupleInvalid("updateInverseMeanRatioTriangleNodes", 0, 7, 8, 5); __PYX_ERR(0, 188, __pyx_L3_error)
4840  }
4841  CYTHON_FALLTHROUGH;
4842  case 6:
4843  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements)) != 0)) kw_args--;
4844  else {
4845  __Pyx_RaiseArgtupleInvalid("updateInverseMeanRatioTriangleNodes", 0, 7, 8, 6); __PYX_ERR(0, 188, __pyx_L3_error)
4846  }
4847  CYTHON_FALLTHROUGH;
4848  case 7:
4849  if (kw_args > 0) {
4850  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_el_average);
4851  if (value) { values[7] = value; kw_args--; }
4852  }
4853  }
4854  if (unlikely(kw_args > 0)) {
4855  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "updateInverseMeanRatioTriangleNodes") < 0)) __PYX_ERR(0, 188, __pyx_L3_error)
4856  }
4857  } else {
4858  switch (PyTuple_GET_SIZE(__pyx_args)) {
4859  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
4860  CYTHON_FALLTHROUGH;
4861  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
4862  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
4863  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4864  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4865  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4866  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4867  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4868  break;
4869  default: goto __pyx_L5_argtuple_error;
4870  }
4871  }
4872  __pyx_v_IMRNodesArray_ = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_IMRNodesArray_.memview)) __PYX_ERR(0, 188, __pyx_L3_error)
4873  __pyx_v_nodeArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeArray.memview)) __PYX_ERR(0, 189, __pyx_L3_error)
4874  __pyx_v_elementNodesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementNodesArray.memview)) __PYX_ERR(0, 190, __pyx_L3_error)
4875  __pyx_v_nodeElementOffsets = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementOffsets.memview)) __PYX_ERR(0, 191, __pyx_L3_error)
4876  __pyx_v_nodeElementsArray = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementsArray.memview)) __PYX_ERR(0, 192, __pyx_L3_error)
4877  __pyx_v_nNodes = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nNodes == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 193, __pyx_L3_error)
4878  __pyx_v_nElements = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_nElements == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 194, __pyx_L3_error)
4879  if (values[7]) {
4880  __pyx_v_el_average = __Pyx_PyObject_IsTrue(values[7]); if (unlikely((__pyx_v_el_average == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 195, __pyx_L3_error)
4881  } else {
4882 
4883  /* "mprans/MeshSmoothing.pyx":195
4884  * int nNodes,
4885  * int nElements,
4886  * bool el_average=False): # <<<<<<<<<<<<<<
4887  * cyUpdateInverseMeanRatioTriangleNodes(IMRNodesArray_=IMRNodesArray_,
4888  * nodeArray=nodeArray,
4889  */
4890  __pyx_v_el_average = ((bool)0);
4891  }
4892  }
4893  goto __pyx_L4_argument_unpacking_done;
4894  __pyx_L5_argtuple_error:;
4895  __Pyx_RaiseArgtupleInvalid("updateInverseMeanRatioTriangleNodes", 0, 7, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 188, __pyx_L3_error)
4896  __pyx_L3_error:;
4897  __Pyx_AddTraceback("mprans.MeshSmoothing.updateInverseMeanRatioTriangleNodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
4898  __Pyx_RefNannyFinishContext();
4899  return NULL;
4900  __pyx_L4_argument_unpacking_done:;
4901  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_16updateInverseMeanRatioTriangleNodes(__pyx_self, __pyx_v_IMRNodesArray_, __pyx_v_nodeArray, __pyx_v_elementNodesArray, __pyx_v_nodeElementOffsets, __pyx_v_nodeElementsArray, __pyx_v_nNodes, __pyx_v_nElements, __pyx_v_el_average);
4902 
4903  /* "mprans/MeshSmoothing.pyx":188
4904  * return IMRElementsArray_
4905  *
4906  * def updateInverseMeanRatioTriangleNodes(double[:] IMRNodesArray_, # <<<<<<<<<<<<<<
4907  * double[:,:] nodeArray,
4908  * int[:,:] elementNodesArray,
4909  */
4910 
4911  /* function exit code */
4912  __Pyx_RefNannyFinishContext();
4913  return __pyx_r;
4914 }
4915 
4916 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_16updateInverseMeanRatioTriangleNodes(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_IMRNodesArray_, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementNodesArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_nodeElementsArray, int __pyx_v_nNodes, int __pyx_v_nElements, bool __pyx_v_el_average) {
4917  PyObject *__pyx_r = NULL;
4918  __Pyx_RefNannyDeclarations
4919  struct __pyx_opt_args_6mprans_13MeshSmoothing_cyUpdateInverseMeanRatioTriangleNodes __pyx_t_1;
4920  __Pyx_RefNannySetupContext("updateInverseMeanRatioTriangleNodes", 0);
4921 
4922  /* "mprans/MeshSmoothing.pyx":196
4923  * int nElements,
4924  * bool el_average=False):
4925  * cyUpdateInverseMeanRatioTriangleNodes(IMRNodesArray_=IMRNodesArray_, # <<<<<<<<<<<<<<
4926  * nodeArray=nodeArray,
4927  * elementNodesArray=elementNodesArray,
4928  */
4929  __pyx_t_1.__pyx_n = 1;
4930  __pyx_t_1.el_average = __pyx_v_el_average;
4931  __pyx_f_6mprans_13MeshSmoothing_cyUpdateInverseMeanRatioTriangleNodes(__pyx_v_IMRNodesArray_, __pyx_v_nodeArray, __pyx_v_elementNodesArray, __pyx_v_nodeElementOffsets, __pyx_v_nodeElementsArray, __pyx_v_nElements, __pyx_v_nNodes, &__pyx_t_1);
4932 
4933  /* "mprans/MeshSmoothing.pyx":188
4934  * return IMRElementsArray_
4935  *
4936  * def updateInverseMeanRatioTriangleNodes(double[:] IMRNodesArray_, # <<<<<<<<<<<<<<
4937  * double[:,:] nodeArray,
4938  * int[:,:] elementNodesArray,
4939  */
4940 
4941  /* function exit code */
4942  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4943  __PYX_XDEC_MEMVIEW(&__pyx_v_IMRNodesArray_, 1);
4944  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray, 1);
4945  __PYX_XDEC_MEMVIEW(&__pyx_v_elementNodesArray, 1);
4946  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementOffsets, 1);
4947  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementsArray, 1);
4948  __Pyx_XGIVEREF(__pyx_r);
4949  __Pyx_RefNannyFinishContext();
4950  return __pyx_r;
4951 }
4952 
4953 /* "mprans/MeshSmoothing.pyx":205
4954  * nElements=nElements)
4955  *
4956  * def getInverseMeanRatioTriangleNodes(double[:,:] nodeArray, # <<<<<<<<<<<<<<
4957  * int[:,:] elementNodesArray,
4958  * int[:] nodeElementOffsets,
4959  */
4960 
4961 /* Python wrapper */
4962 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_19getInverseMeanRatioTriangleNodes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4963 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_19getInverseMeanRatioTriangleNodes = {"getInverseMeanRatioTriangleNodes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_19getInverseMeanRatioTriangleNodes, METH_VARARGS|METH_KEYWORDS, 0};
4964 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_19getInverseMeanRatioTriangleNodes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4965  __Pyx_memviewslice __pyx_v_nodeArray = { 0, 0, { 0 }, { 0 }, { 0 } };
4966  __Pyx_memviewslice __pyx_v_elementNodesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
4967  __Pyx_memviewslice __pyx_v_nodeElementOffsets = { 0, 0, { 0 }, { 0 }, { 0 } };
4968  __Pyx_memviewslice __pyx_v_nodeElementsArray = { 0, 0, { 0 }, { 0 }, { 0 } };
4969  bool __pyx_v_el_average;
4970  PyObject *__pyx_r = 0;
4971  __Pyx_RefNannyDeclarations
4972  __Pyx_RefNannySetupContext("getInverseMeanRatioTriangleNodes (wrapper)", 0);
4973  {
4974  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nodeArray_2,&__pyx_n_s_elementNodesArray,&__pyx_n_s_nodeElementOffsets,&__pyx_n_s_nodeElementsArray,&__pyx_n_s_el_average,0};
4975  PyObject* values[5] = {0,0,0,0,0};
4976  if (unlikely(__pyx_kwds)) {
4977  Py_ssize_t kw_args;
4978  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4979  switch (pos_args) {
4980  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4981  CYTHON_FALLTHROUGH;
4982  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4983  CYTHON_FALLTHROUGH;
4984  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4985  CYTHON_FALLTHROUGH;
4986  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4987  CYTHON_FALLTHROUGH;
4988  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4989  CYTHON_FALLTHROUGH;
4990  case 0: break;
4991  default: goto __pyx_L5_argtuple_error;
4992  }
4993  kw_args = PyDict_Size(__pyx_kwds);
4994  switch (pos_args) {
4995  case 0:
4996  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeArray_2)) != 0)) kw_args--;
4997  else goto __pyx_L5_argtuple_error;
4998  CYTHON_FALLTHROUGH;
4999  case 1:
5000  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNodesArray)) != 0)) kw_args--;
5001  else {
5002  __Pyx_RaiseArgtupleInvalid("getInverseMeanRatioTriangleNodes", 0, 4, 5, 1); __PYX_ERR(0, 205, __pyx_L3_error)
5003  }
5004  CYTHON_FALLTHROUGH;
5005  case 2:
5006  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementOffsets)) != 0)) kw_args--;
5007  else {
5008  __Pyx_RaiseArgtupleInvalid("getInverseMeanRatioTriangleNodes", 0, 4, 5, 2); __PYX_ERR(0, 205, __pyx_L3_error)
5009  }
5010  CYTHON_FALLTHROUGH;
5011  case 3:
5012  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementsArray)) != 0)) kw_args--;
5013  else {
5014  __Pyx_RaiseArgtupleInvalid("getInverseMeanRatioTriangleNodes", 0, 4, 5, 3); __PYX_ERR(0, 205, __pyx_L3_error)
5015  }
5016  CYTHON_FALLTHROUGH;
5017  case 4:
5018  if (kw_args > 0) {
5019  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_el_average);
5020  if (value) { values[4] = value; kw_args--; }
5021  }
5022  }
5023  if (unlikely(kw_args > 0)) {
5024  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getInverseMeanRatioTriangleNodes") < 0)) __PYX_ERR(0, 205, __pyx_L3_error)
5025  }
5026  } else {
5027  switch (PyTuple_GET_SIZE(__pyx_args)) {
5028  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5029  CYTHON_FALLTHROUGH;
5030  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5031  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5032  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5033  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5034  break;
5035  default: goto __pyx_L5_argtuple_error;
5036  }
5037  }
5038  __pyx_v_nodeArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeArray.memview)) __PYX_ERR(0, 205, __pyx_L3_error)
5039  __pyx_v_elementNodesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementNodesArray.memview)) __PYX_ERR(0, 206, __pyx_L3_error)
5040  __pyx_v_nodeElementOffsets = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementOffsets.memview)) __PYX_ERR(0, 207, __pyx_L3_error)
5041  __pyx_v_nodeElementsArray = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementsArray.memview)) __PYX_ERR(0, 208, __pyx_L3_error)
5042  if (values[4]) {
5043  __pyx_v_el_average = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_el_average == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 209, __pyx_L3_error)
5044  } else {
5045 
5046  /* "mprans/MeshSmoothing.pyx":209
5047  * int[:] nodeElementOffsets,
5048  * int[:] nodeElementsArray,
5049  * bool el_average=False): # <<<<<<<<<<<<<<
5050  * cdef int nNodes = len(nodeArray)
5051  * cdef int nElements = len(elementNodesArray)
5052  */
5053  __pyx_v_el_average = ((bool)0);
5054  }
5055  }
5056  goto __pyx_L4_argument_unpacking_done;
5057  __pyx_L5_argtuple_error:;
5058  __Pyx_RaiseArgtupleInvalid("getInverseMeanRatioTriangleNodes", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 205, __pyx_L3_error)
5059  __pyx_L3_error:;
5060  __Pyx_AddTraceback("mprans.MeshSmoothing.getInverseMeanRatioTriangleNodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
5061  __Pyx_RefNannyFinishContext();
5062  return NULL;
5063  __pyx_L4_argument_unpacking_done:;
5064  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_18getInverseMeanRatioTriangleNodes(__pyx_self, __pyx_v_nodeArray, __pyx_v_elementNodesArray, __pyx_v_nodeElementOffsets, __pyx_v_nodeElementsArray, __pyx_v_el_average);
5065 
5066  /* "mprans/MeshSmoothing.pyx":205
5067  * nElements=nElements)
5068  *
5069  * def getInverseMeanRatioTriangleNodes(double[:,:] nodeArray, # <<<<<<<<<<<<<<
5070  * int[:,:] elementNodesArray,
5071  * int[:] nodeElementOffsets,
5072  */
5073 
5074  /* function exit code */
5075  __Pyx_RefNannyFinishContext();
5076  return __pyx_r;
5077 }
5078 
5079 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_18getInverseMeanRatioTriangleNodes(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementNodesArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_nodeElementsArray, bool __pyx_v_el_average) {
5080  int __pyx_v_nNodes;
5081  int __pyx_v_nElements;
5082  PyObject *__pyx_v_IMRNodesArray_ = NULL;
5083  PyObject *__pyx_r = NULL;
5084  __Pyx_RefNannyDeclarations
5085  size_t __pyx_t_1;
5086  PyObject *__pyx_t_2 = NULL;
5087  PyObject *__pyx_t_3 = NULL;
5088  PyObject *__pyx_t_4 = NULL;
5089  PyObject *__pyx_t_5 = NULL;
5090  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
5091  struct __pyx_opt_args_6mprans_13MeshSmoothing_cyUpdateInverseMeanRatioTriangleNodes __pyx_t_7;
5092  __Pyx_RefNannySetupContext("getInverseMeanRatioTriangleNodes", 0);
5093 
5094  /* "mprans/MeshSmoothing.pyx":210
5095  * int[:] nodeElementsArray,
5096  * bool el_average=False):
5097  * cdef int nNodes = len(nodeArray) # <<<<<<<<<<<<<<
5098  * cdef int nElements = len(elementNodesArray)
5099  * IMRNodesArray_ = np.zeros(nNodes)
5100  */
5101  __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_nodeArray);
5102  __pyx_v_nNodes = __pyx_t_1;
5103 
5104  /* "mprans/MeshSmoothing.pyx":211
5105  * bool el_average=False):
5106  * cdef int nNodes = len(nodeArray)
5107  * cdef int nElements = len(elementNodesArray) # <<<<<<<<<<<<<<
5108  * IMRNodesArray_ = np.zeros(nNodes)
5109  * cyUpdateInverseMeanRatioTriangleNodes(IMRNodesArray_=IMRNodesArray_,
5110  */
5111  __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_elementNodesArray);
5112  __pyx_v_nElements = __pyx_t_1;
5113 
5114  /* "mprans/MeshSmoothing.pyx":212
5115  * cdef int nNodes = len(nodeArray)
5116  * cdef int nElements = len(elementNodesArray)
5117  * IMRNodesArray_ = np.zeros(nNodes) # <<<<<<<<<<<<<<
5118  * cyUpdateInverseMeanRatioTriangleNodes(IMRNodesArray_=IMRNodesArray_,
5119  * nodeArray=nodeArray,
5120  */
5121  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 212, __pyx_L1_error)
5122  __Pyx_GOTREF(__pyx_t_3);
5123  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 212, __pyx_L1_error)
5124  __Pyx_GOTREF(__pyx_t_4);
5125  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5126  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nNodes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 212, __pyx_L1_error)
5127  __Pyx_GOTREF(__pyx_t_3);
5128  __pyx_t_5 = NULL;
5129  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
5130  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
5131  if (likely(__pyx_t_5)) {
5132  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
5133  __Pyx_INCREF(__pyx_t_5);
5134  __Pyx_INCREF(function);
5135  __Pyx_DECREF_SET(__pyx_t_4, function);
5136  }
5137  }
5138  __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
5139  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
5140  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5141  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __pyx_L1_error)
5142  __Pyx_GOTREF(__pyx_t_2);
5143  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5144  __pyx_v_IMRNodesArray_ = __pyx_t_2;
5145  __pyx_t_2 = 0;
5146 
5147  /* "mprans/MeshSmoothing.pyx":213
5148  * cdef int nElements = len(elementNodesArray)
5149  * IMRNodesArray_ = np.zeros(nNodes)
5150  * cyUpdateInverseMeanRatioTriangleNodes(IMRNodesArray_=IMRNodesArray_, # <<<<<<<<<<<<<<
5151  * nodeArray=nodeArray,
5152  * elementNodesArray=elementNodesArray,
5153  */
5154  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_IMRNodesArray_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 213, __pyx_L1_error)
5155 
5156  /* "mprans/MeshSmoothing.pyx":218
5157  * nodeElementOffsets=nodeElementOffsets,
5158  * nodeElementsArray=nodeElementsArray,
5159  * el_average=el_average, # <<<<<<<<<<<<<<
5160  * nNodes=nNodes,
5161  * nElements=nElements)
5162  */
5163  __pyx_t_7.__pyx_n = 1;
5164  __pyx_t_7.el_average = __pyx_v_el_average;
5165  __pyx_f_6mprans_13MeshSmoothing_cyUpdateInverseMeanRatioTriangleNodes(__pyx_t_6, __pyx_v_nodeArray, __pyx_v_elementNodesArray, __pyx_v_nodeElementOffsets, __pyx_v_nodeElementsArray, __pyx_v_nElements, __pyx_v_nNodes, &__pyx_t_7);
5166  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
5167  __pyx_t_6.memview = NULL;
5168  __pyx_t_6.data = NULL;
5169 
5170  /* "mprans/MeshSmoothing.pyx":221
5171  * nNodes=nNodes,
5172  * nElements=nElements)
5173  * return IMRNodesArray_ # <<<<<<<<<<<<<<
5174  *
5175  * def getInverseMeanRatioSingleTriangle(int node0,
5176  */
5177  __Pyx_XDECREF(__pyx_r);
5178  __Pyx_INCREF(__pyx_v_IMRNodesArray_);
5179  __pyx_r = __pyx_v_IMRNodesArray_;
5180  goto __pyx_L0;
5181 
5182  /* "mprans/MeshSmoothing.pyx":205
5183  * nElements=nElements)
5184  *
5185  * def getInverseMeanRatioTriangleNodes(double[:,:] nodeArray, # <<<<<<<<<<<<<<
5186  * int[:,:] elementNodesArray,
5187  * int[:] nodeElementOffsets,
5188  */
5189 
5190  /* function exit code */
5191  __pyx_L1_error:;
5192  __Pyx_XDECREF(__pyx_t_2);
5193  __Pyx_XDECREF(__pyx_t_3);
5194  __Pyx_XDECREF(__pyx_t_4);
5195  __Pyx_XDECREF(__pyx_t_5);
5196  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
5197  __Pyx_AddTraceback("mprans.MeshSmoothing.getInverseMeanRatioTriangleNodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
5198  __pyx_r = NULL;
5199  __pyx_L0:;
5200  __Pyx_XDECREF(__pyx_v_IMRNodesArray_);
5201  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray, 1);
5202  __PYX_XDEC_MEMVIEW(&__pyx_v_elementNodesArray, 1);
5203  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementOffsets, 1);
5204  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementsArray, 1);
5205  __Pyx_XGIVEREF(__pyx_r);
5206  __Pyx_RefNannyFinishContext();
5207  return __pyx_r;
5208 }
5209 
5210 /* "mprans/MeshSmoothing.pyx":223
5211  * return IMRNodesArray_
5212  *
5213  * def getInverseMeanRatioSingleTriangle(int node0, # <<<<<<<<<<<<<<
5214  * double[:,:] nodeArray,
5215  * int[:,:] elementNodesArray,
5216  */
5217 
5218 /* Python wrapper */
5219 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_21getInverseMeanRatioSingleTriangle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5220 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_21getInverseMeanRatioSingleTriangle = {"getInverseMeanRatioSingleTriangle", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_21getInverseMeanRatioSingleTriangle, METH_VARARGS|METH_KEYWORDS, 0};
5221 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_21getInverseMeanRatioSingleTriangle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5222  int __pyx_v_node0;
5223  __Pyx_memviewslice __pyx_v_nodeArray = { 0, 0, { 0 }, { 0 }, { 0 } };
5224  __Pyx_memviewslice __pyx_v_elementNodesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
5225  __Pyx_memviewslice __pyx_v_nodeElementOffsets = { 0, 0, { 0 }, { 0 }, { 0 } };
5226  __Pyx_memviewslice __pyx_v_nodeElementsArray = { 0, 0, { 0 }, { 0 }, { 0 } };
5227  PyObject *__pyx_r = 0;
5228  __Pyx_RefNannyDeclarations
5229  __Pyx_RefNannySetupContext("getInverseMeanRatioSingleTriangle (wrapper)", 0);
5230  {
5231  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_node0,&__pyx_n_s_nodeArray_2,&__pyx_n_s_elementNodesArray,&__pyx_n_s_nodeElementOffsets,&__pyx_n_s_nodeElementsArray,0};
5232  PyObject* values[5] = {0,0,0,0,0};
5233  if (unlikely(__pyx_kwds)) {
5234  Py_ssize_t kw_args;
5235  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5236  switch (pos_args) {
5237  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5238  CYTHON_FALLTHROUGH;
5239  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5240  CYTHON_FALLTHROUGH;
5241  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5242  CYTHON_FALLTHROUGH;
5243  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5244  CYTHON_FALLTHROUGH;
5245  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5246  CYTHON_FALLTHROUGH;
5247  case 0: break;
5248  default: goto __pyx_L5_argtuple_error;
5249  }
5250  kw_args = PyDict_Size(__pyx_kwds);
5251  switch (pos_args) {
5252  case 0:
5253  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_node0)) != 0)) kw_args--;
5254  else goto __pyx_L5_argtuple_error;
5255  CYTHON_FALLTHROUGH;
5256  case 1:
5257  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeArray_2)) != 0)) kw_args--;
5258  else {
5259  __Pyx_RaiseArgtupleInvalid("getInverseMeanRatioSingleTriangle", 1, 5, 5, 1); __PYX_ERR(0, 223, __pyx_L3_error)
5260  }
5261  CYTHON_FALLTHROUGH;
5262  case 2:
5263  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNodesArray)) != 0)) kw_args--;
5264  else {
5265  __Pyx_RaiseArgtupleInvalid("getInverseMeanRatioSingleTriangle", 1, 5, 5, 2); __PYX_ERR(0, 223, __pyx_L3_error)
5266  }
5267  CYTHON_FALLTHROUGH;
5268  case 3:
5269  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementOffsets)) != 0)) kw_args--;
5270  else {
5271  __Pyx_RaiseArgtupleInvalid("getInverseMeanRatioSingleTriangle", 1, 5, 5, 3); __PYX_ERR(0, 223, __pyx_L3_error)
5272  }
5273  CYTHON_FALLTHROUGH;
5274  case 4:
5275  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementsArray)) != 0)) kw_args--;
5276  else {
5277  __Pyx_RaiseArgtupleInvalid("getInverseMeanRatioSingleTriangle", 1, 5, 5, 4); __PYX_ERR(0, 223, __pyx_L3_error)
5278  }
5279  }
5280  if (unlikely(kw_args > 0)) {
5281  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getInverseMeanRatioSingleTriangle") < 0)) __PYX_ERR(0, 223, __pyx_L3_error)
5282  }
5283  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
5284  goto __pyx_L5_argtuple_error;
5285  } else {
5286  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5287  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5288  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5289  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5290  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5291  }
5292  __pyx_v_node0 = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_node0 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 223, __pyx_L3_error)
5293  __pyx_v_nodeArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeArray.memview)) __PYX_ERR(0, 224, __pyx_L3_error)
5294  __pyx_v_elementNodesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementNodesArray.memview)) __PYX_ERR(0, 225, __pyx_L3_error)
5295  __pyx_v_nodeElementOffsets = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementOffsets.memview)) __PYX_ERR(0, 226, __pyx_L3_error)
5296  __pyx_v_nodeElementsArray = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementsArray.memview)) __PYX_ERR(0, 227, __pyx_L3_error)
5297  }
5298  goto __pyx_L4_argument_unpacking_done;
5299  __pyx_L5_argtuple_error:;
5300  __Pyx_RaiseArgtupleInvalid("getInverseMeanRatioSingleTriangle", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 223, __pyx_L3_error)
5301  __pyx_L3_error:;
5302  __Pyx_AddTraceback("mprans.MeshSmoothing.getInverseMeanRatioSingleTriangle", __pyx_clineno, __pyx_lineno, __pyx_filename);
5303  __Pyx_RefNannyFinishContext();
5304  return NULL;
5305  __pyx_L4_argument_unpacking_done:;
5306  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_20getInverseMeanRatioSingleTriangle(__pyx_self, __pyx_v_node0, __pyx_v_nodeArray, __pyx_v_elementNodesArray, __pyx_v_nodeElementOffsets, __pyx_v_nodeElementsArray);
5307 
5308  /* function exit code */
5309  __Pyx_RefNannyFinishContext();
5310  return __pyx_r;
5311 }
5312 
5313 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_20getInverseMeanRatioSingleTriangle(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_node0, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementNodesArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_nodeElementsArray) {
5314  PyObject *__pyx_r = NULL;
5315  __Pyx_RefNannyDeclarations
5316  PyObject *__pyx_t_1 = NULL;
5317  __Pyx_RefNannySetupContext("getInverseMeanRatioSingleTriangle", 0);
5318 
5319  /* "mprans/MeshSmoothing.pyx":228
5320  * int[:] nodeElementOffsets,
5321  * int[:] nodeElementsArray):
5322  * return cyGetInverseMeanRatioSingleTriangle(node0=node0, # <<<<<<<<<<<<<<
5323  * nodeArray=nodeArray,
5324  * elementNodesArray=elementNodesArray,
5325  */
5326  __Pyx_XDECREF(__pyx_r);
5327 
5328  /* "mprans/MeshSmoothing.pyx":232
5329  * elementNodesArray=elementNodesArray,
5330  * nodeElementOffsets=nodeElementOffsets,
5331  * nodeElementsArray=nodeElementsArray) # <<<<<<<<<<<<<<
5332  *
5333  * def smoothNodesQuality(double[:] distortion,
5334  */
5335  __pyx_t_1 = PyFloat_FromDouble(__pyx_f_6mprans_13MeshSmoothing_cyGetInverseMeanRatioSingleTriangle(__pyx_v_node0, __pyx_v_nodeArray, __pyx_v_elementNodesArray, __pyx_v_nodeElementOffsets, __pyx_v_nodeElementsArray, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __pyx_L1_error)
5336  __Pyx_GOTREF(__pyx_t_1);
5337  __pyx_r = __pyx_t_1;
5338  __pyx_t_1 = 0;
5339  goto __pyx_L0;
5340 
5341  /* "mprans/MeshSmoothing.pyx":223
5342  * return IMRNodesArray_
5343  *
5344  * def getInverseMeanRatioSingleTriangle(int node0, # <<<<<<<<<<<<<<
5345  * double[:,:] nodeArray,
5346  * int[:,:] elementNodesArray,
5347  */
5348 
5349  /* function exit code */
5350  __pyx_L1_error:;
5351  __Pyx_XDECREF(__pyx_t_1);
5352  __Pyx_AddTraceback("mprans.MeshSmoothing.getInverseMeanRatioSingleTriangle", __pyx_clineno, __pyx_lineno, __pyx_filename);
5353  __pyx_r = NULL;
5354  __pyx_L0:;
5355  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray, 1);
5356  __PYX_XDEC_MEMVIEW(&__pyx_v_elementNodesArray, 1);
5357  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementOffsets, 1);
5358  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementsArray, 1);
5359  __Pyx_XGIVEREF(__pyx_r);
5360  __Pyx_RefNannyFinishContext();
5361  return __pyx_r;
5362 }
5363 
5364 /* "mprans/MeshSmoothing.pyx":234
5365  * nodeElementsArray=nodeElementsArray)
5366  *
5367  * def smoothNodesQuality(double[:] distortion, # <<<<<<<<<<<<<<
5368  * double[:] dilation,
5369  * double[:,:] nodeArray,
5370  */
5371 
5372 /* Python wrapper */
5373 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_23smoothNodesQuality(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5374 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_23smoothNodesQuality = {"smoothNodesQuality", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_23smoothNodesQuality, METH_VARARGS|METH_KEYWORDS, 0};
5375 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_23smoothNodesQuality(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5376  __Pyx_memviewslice __pyx_v_distortion = { 0, 0, { 0 }, { 0 }, { 0 } };
5377  __Pyx_memviewslice __pyx_v_dilation = { 0, 0, { 0 }, { 0 }, { 0 } };
5378  __Pyx_memviewslice __pyx_v_nodeArray = { 0, 0, { 0 }, { 0 }, { 0 } };
5379  int __pyx_v_nNodes_owned;
5380  __Pyx_memviewslice __pyx_v_nodeMaterialTypes = { 0, 0, { 0 }, { 0 }, { 0 } };
5381  __Pyx_memviewslice __pyx_v_nodeElementOffsets = { 0, 0, { 0 }, { 0 }, { 0 } };
5382  __Pyx_memviewslice __pyx_v_nodeElementsArray = { 0, 0, { 0 }, { 0 }, { 0 } };
5383  __Pyx_memviewslice __pyx_v_elementNodesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
5384  CYTHON_UNUSED bool __pyx_v_apply_directly;
5385  PyObject *__pyx_r = 0;
5386  __Pyx_RefNannyDeclarations
5387  __Pyx_RefNannySetupContext("smoothNodesQuality (wrapper)", 0);
5388  {
5389  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distortion,&__pyx_n_s_dilation,&__pyx_n_s_nodeArray_2,&__pyx_n_s_nNodes_owned,&__pyx_n_s_nodeMaterialTypes,&__pyx_n_s_nodeElementOffsets,&__pyx_n_s_nodeElementsArray,&__pyx_n_s_elementNodesArray,&__pyx_n_s_apply_directly,0};
5390  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
5391  if (unlikely(__pyx_kwds)) {
5392  Py_ssize_t kw_args;
5393  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5394  switch (pos_args) {
5395  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
5396  CYTHON_FALLTHROUGH;
5397  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
5398  CYTHON_FALLTHROUGH;
5399  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
5400  CYTHON_FALLTHROUGH;
5401  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
5402  CYTHON_FALLTHROUGH;
5403  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5404  CYTHON_FALLTHROUGH;
5405  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5406  CYTHON_FALLTHROUGH;
5407  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5408  CYTHON_FALLTHROUGH;
5409  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5410  CYTHON_FALLTHROUGH;
5411  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5412  CYTHON_FALLTHROUGH;
5413  case 0: break;
5414  default: goto __pyx_L5_argtuple_error;
5415  }
5416  kw_args = PyDict_Size(__pyx_kwds);
5417  switch (pos_args) {
5418  case 0:
5419  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_distortion)) != 0)) kw_args--;
5420  else goto __pyx_L5_argtuple_error;
5421  CYTHON_FALLTHROUGH;
5422  case 1:
5423  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dilation)) != 0)) kw_args--;
5424  else {
5425  __Pyx_RaiseArgtupleInvalid("smoothNodesQuality", 0, 8, 9, 1); __PYX_ERR(0, 234, __pyx_L3_error)
5426  }
5427  CYTHON_FALLTHROUGH;
5428  case 2:
5429  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeArray_2)) != 0)) kw_args--;
5430  else {
5431  __Pyx_RaiseArgtupleInvalid("smoothNodesQuality", 0, 8, 9, 2); __PYX_ERR(0, 234, __pyx_L3_error)
5432  }
5433  CYTHON_FALLTHROUGH;
5434  case 3:
5435  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nNodes_owned)) != 0)) kw_args--;
5436  else {
5437  __Pyx_RaiseArgtupleInvalid("smoothNodesQuality", 0, 8, 9, 3); __PYX_ERR(0, 234, __pyx_L3_error)
5438  }
5439  CYTHON_FALLTHROUGH;
5440  case 4:
5441  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeMaterialTypes)) != 0)) kw_args--;
5442  else {
5443  __Pyx_RaiseArgtupleInvalid("smoothNodesQuality", 0, 8, 9, 4); __PYX_ERR(0, 234, __pyx_L3_error)
5444  }
5445  CYTHON_FALLTHROUGH;
5446  case 5:
5447  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementOffsets)) != 0)) kw_args--;
5448  else {
5449  __Pyx_RaiseArgtupleInvalid("smoothNodesQuality", 0, 8, 9, 5); __PYX_ERR(0, 234, __pyx_L3_error)
5450  }
5451  CYTHON_FALLTHROUGH;
5452  case 6:
5453  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementsArray)) != 0)) kw_args--;
5454  else {
5455  __Pyx_RaiseArgtupleInvalid("smoothNodesQuality", 0, 8, 9, 6); __PYX_ERR(0, 234, __pyx_L3_error)
5456  }
5457  CYTHON_FALLTHROUGH;
5458  case 7:
5459  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNodesArray)) != 0)) kw_args--;
5460  else {
5461  __Pyx_RaiseArgtupleInvalid("smoothNodesQuality", 0, 8, 9, 7); __PYX_ERR(0, 234, __pyx_L3_error)
5462  }
5463  CYTHON_FALLTHROUGH;
5464  case 8:
5465  if (kw_args > 0) {
5466  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_apply_directly);
5467  if (value) { values[8] = value; kw_args--; }
5468  }
5469  }
5470  if (unlikely(kw_args > 0)) {
5471  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "smoothNodesQuality") < 0)) __PYX_ERR(0, 234, __pyx_L3_error)
5472  }
5473  } else {
5474  switch (PyTuple_GET_SIZE(__pyx_args)) {
5475  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
5476  CYTHON_FALLTHROUGH;
5477  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
5478  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
5479  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
5480  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5481  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5482  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5483  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5484  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5485  break;
5486  default: goto __pyx_L5_argtuple_error;
5487  }
5488  }
5489  __pyx_v_distortion = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_distortion.memview)) __PYX_ERR(0, 234, __pyx_L3_error)
5490  __pyx_v_dilation = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dilation.memview)) __PYX_ERR(0, 235, __pyx_L3_error)
5491  __pyx_v_nodeArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeArray.memview)) __PYX_ERR(0, 236, __pyx_L3_error)
5492  __pyx_v_nNodes_owned = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nNodes_owned == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 237, __pyx_L3_error)
5493  __pyx_v_nodeMaterialTypes = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeMaterialTypes.memview)) __PYX_ERR(0, 238, __pyx_L3_error)
5494  __pyx_v_nodeElementOffsets = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementOffsets.memview)) __PYX_ERR(0, 239, __pyx_L3_error)
5495  __pyx_v_nodeElementsArray = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementsArray.memview)) __PYX_ERR(0, 240, __pyx_L3_error)
5496  __pyx_v_elementNodesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[7], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementNodesArray.memview)) __PYX_ERR(0, 241, __pyx_L3_error)
5497  if (values[8]) {
5498  __pyx_v_apply_directly = __Pyx_PyObject_IsTrue(values[8]); if (unlikely((__pyx_v_apply_directly == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L3_error)
5499  } else {
5500 
5501  /* "mprans/MeshSmoothing.pyx":242
5502  * int[:] nodeElementsArray,
5503  * int[:,:] elementNodesArray,
5504  * bool apply_directly=False): # <<<<<<<<<<<<<<
5505  * assert 1>2, 'smoothNodesQuality is work in progress, do not use'
5506  * return cySmoothNodesQuality(distortion=distortion,
5507  */
5508  __pyx_v_apply_directly = ((bool)0);
5509  }
5510  }
5511  goto __pyx_L4_argument_unpacking_done;
5512  __pyx_L5_argtuple_error:;
5513  __Pyx_RaiseArgtupleInvalid("smoothNodesQuality", 0, 8, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 234, __pyx_L3_error)
5514  __pyx_L3_error:;
5515  __Pyx_AddTraceback("mprans.MeshSmoothing.smoothNodesQuality", __pyx_clineno, __pyx_lineno, __pyx_filename);
5516  __Pyx_RefNannyFinishContext();
5517  return NULL;
5518  __pyx_L4_argument_unpacking_done:;
5519  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_22smoothNodesQuality(__pyx_self, __pyx_v_distortion, __pyx_v_dilation, __pyx_v_nodeArray, __pyx_v_nNodes_owned, __pyx_v_nodeMaterialTypes, __pyx_v_nodeElementOffsets, __pyx_v_nodeElementsArray, __pyx_v_elementNodesArray, __pyx_v_apply_directly);
5520 
5521  /* "mprans/MeshSmoothing.pyx":234
5522  * nodeElementsArray=nodeElementsArray)
5523  *
5524  * def smoothNodesQuality(double[:] distortion, # <<<<<<<<<<<<<<
5525  * double[:] dilation,
5526  * double[:,:] nodeArray,
5527  */
5528 
5529  /* function exit code */
5530  __Pyx_RefNannyFinishContext();
5531  return __pyx_r;
5532 }
5533 
5534 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_22smoothNodesQuality(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_distortion, __Pyx_memviewslice __pyx_v_dilation, __Pyx_memviewslice __pyx_v_nodeArray, int __pyx_v_nNodes_owned, __Pyx_memviewslice __pyx_v_nodeMaterialTypes, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_elementNodesArray, CYTHON_UNUSED bool __pyx_v_apply_directly) {
5535  PyObject *__pyx_r = NULL;
5536  __Pyx_RefNannyDeclarations
5537  __Pyx_memviewslice __pyx_t_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
5538  struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesQuality __pyx_t_2;
5539  PyObject *__pyx_t_3 = NULL;
5540  __Pyx_RefNannySetupContext("smoothNodesQuality", 0);
5541 
5542  /* "mprans/MeshSmoothing.pyx":243
5543  * int[:,:] elementNodesArray,
5544  * bool apply_directly=False):
5545  * assert 1>2, 'smoothNodesQuality is work in progress, do not use' # <<<<<<<<<<<<<<
5546  * return cySmoothNodesQuality(distortion=distortion,
5547  * dilation=dilation,
5548  */
5549  #ifndef CYTHON_WITHOUT_ASSERTIONS
5550  if (unlikely(!Py_OptimizeFlag)) {
5551  if (unlikely(!0)) {
5552  PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_smoothNodesQuality_is_work_in_pr);
5553  __PYX_ERR(0, 243, __pyx_L1_error)
5554  }
5555  }
5556  #endif
5557 
5558  /* "mprans/MeshSmoothing.pyx":244
5559  * bool apply_directly=False):
5560  * assert 1>2, 'smoothNodesQuality is work in progress, do not use'
5561  * return cySmoothNodesQuality(distortion=distortion, # <<<<<<<<<<<<<<
5562  * dilation=dilation,
5563  * nodeArray=nodeArray,
5564  */
5565  __Pyx_XDECREF(__pyx_r);
5566 
5567  /* "mprans/MeshSmoothing.pyx":252
5568  * nodeElementsArray=nodeElementsArray,
5569  * elementNodesArray=elementNodesArray,
5570  * apply_directly=False) # <<<<<<<<<<<<<<
5571  *
5572  * def getLocalNearestNode(double[:] coords,
5573  */
5574  __pyx_t_2.__pyx_n = 1;
5575  __pyx_t_2.apply_directly = 0;
5576  __pyx_t_1 = __pyx_f_6mprans_13MeshSmoothing_cySmoothNodesQuality(__pyx_v_distortion, __pyx_v_dilation, __pyx_v_nodeArray, __pyx_v_nNodes_owned, __pyx_v_nodeMaterialTypes, __pyx_v_nodeElementOffsets, __pyx_v_nodeElementsArray, __pyx_v_elementNodesArray, &__pyx_t_2); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 244, __pyx_L1_error)
5577 
5578  /* "mprans/MeshSmoothing.pyx":244
5579  * bool apply_directly=False):
5580  * assert 1>2, 'smoothNodesQuality is work in progress, do not use'
5581  * return cySmoothNodesQuality(distortion=distortion, # <<<<<<<<<<<<<<
5582  * dilation=dilation,
5583  * nodeArray=nodeArray,
5584  */
5585  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_t_1, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 244, __pyx_L1_error)
5586  __Pyx_GOTREF(__pyx_t_3);
5587  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
5588  __pyx_t_1.memview = NULL;
5589  __pyx_t_1.data = NULL;
5590  __pyx_r = __pyx_t_3;
5591  __pyx_t_3 = 0;
5592  goto __pyx_L0;
5593 
5594  /* "mprans/MeshSmoothing.pyx":234
5595  * nodeElementsArray=nodeElementsArray)
5596  *
5597  * def smoothNodesQuality(double[:] distortion, # <<<<<<<<<<<<<<
5598  * double[:] dilation,
5599  * double[:,:] nodeArray,
5600  */
5601 
5602  /* function exit code */
5603  __pyx_L1_error:;
5604  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
5605  __Pyx_XDECREF(__pyx_t_3);
5606  __Pyx_AddTraceback("mprans.MeshSmoothing.smoothNodesQuality", __pyx_clineno, __pyx_lineno, __pyx_filename);
5607  __pyx_r = NULL;
5608  __pyx_L0:;
5609  __PYX_XDEC_MEMVIEW(&__pyx_v_distortion, 1);
5610  __PYX_XDEC_MEMVIEW(&__pyx_v_dilation, 1);
5611  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray, 1);
5612  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeMaterialTypes, 1);
5613  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementOffsets, 1);
5614  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementsArray, 1);
5615  __PYX_XDEC_MEMVIEW(&__pyx_v_elementNodesArray, 1);
5616  __Pyx_XGIVEREF(__pyx_r);
5617  __Pyx_RefNannyFinishContext();
5618  return __pyx_r;
5619 }
5620 
5621 /* "mprans/MeshSmoothing.pyx":254
5622  * apply_directly=False)
5623  *
5624  * def getLocalNearestNode(double[:] coords, # <<<<<<<<<<<<<<
5625  * double[:,:] nodeArray,
5626  * int[:] nodeStarOffsets,
5627  */
5628 
5629 /* Python wrapper */
5630 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_25getLocalNearestNode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5631 static char __pyx_doc_6mprans_13MeshSmoothing_24getLocalNearestNode[] = "Finds nearest node to coordinates (local)\n\n Parameters\n ----------\n coords: array_like\n coordinates from which to find nearest node\n nodeArray: array_like\n array of fluid mesh node coordinates\n nodeStarOffsets: array_like\n array of offsets from nodes (range)\n nodeStarArray: array_like\n array of neighbouring nodes\n node: int\n first guess for nearest node\n\n Returns\n -------\n node: int\n nearest node index\n ";
5632 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_25getLocalNearestNode = {"getLocalNearestNode", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_25getLocalNearestNode, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mprans_13MeshSmoothing_24getLocalNearestNode};
5633 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_25getLocalNearestNode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5634  __Pyx_memviewslice __pyx_v_coords = { 0, 0, { 0 }, { 0 }, { 0 } };
5635  __Pyx_memviewslice __pyx_v_nodeArray = { 0, 0, { 0 }, { 0 }, { 0 } };
5636  __Pyx_memviewslice __pyx_v_nodeStarOffsets = { 0, 0, { 0 }, { 0 }, { 0 } };
5637  __Pyx_memviewslice __pyx_v_nodeStarArray = { 0, 0, { 0 }, { 0 }, { 0 } };
5638  int __pyx_v_node;
5639  PyObject *__pyx_r = 0;
5640  __Pyx_RefNannyDeclarations
5641  __Pyx_RefNannySetupContext("getLocalNearestNode (wrapper)", 0);
5642  {
5643  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coords,&__pyx_n_s_nodeArray_2,&__pyx_n_s_nodeStarOffsets,&__pyx_n_s_nodeStarArray,&__pyx_n_s_node,0};
5644  PyObject* values[5] = {0,0,0,0,0};
5645  if (unlikely(__pyx_kwds)) {
5646  Py_ssize_t kw_args;
5647  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5648  switch (pos_args) {
5649  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5650  CYTHON_FALLTHROUGH;
5651  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5652  CYTHON_FALLTHROUGH;
5653  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5654  CYTHON_FALLTHROUGH;
5655  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5656  CYTHON_FALLTHROUGH;
5657  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5658  CYTHON_FALLTHROUGH;
5659  case 0: break;
5660  default: goto __pyx_L5_argtuple_error;
5661  }
5662  kw_args = PyDict_Size(__pyx_kwds);
5663  switch (pos_args) {
5664  case 0:
5665  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coords)) != 0)) kw_args--;
5666  else goto __pyx_L5_argtuple_error;
5667  CYTHON_FALLTHROUGH;
5668  case 1:
5669  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeArray_2)) != 0)) kw_args--;
5670  else {
5671  __Pyx_RaiseArgtupleInvalid("getLocalNearestNode", 1, 5, 5, 1); __PYX_ERR(0, 254, __pyx_L3_error)
5672  }
5673  CYTHON_FALLTHROUGH;
5674  case 2:
5675  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeStarOffsets)) != 0)) kw_args--;
5676  else {
5677  __Pyx_RaiseArgtupleInvalid("getLocalNearestNode", 1, 5, 5, 2); __PYX_ERR(0, 254, __pyx_L3_error)
5678  }
5679  CYTHON_FALLTHROUGH;
5680  case 3:
5681  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeStarArray)) != 0)) kw_args--;
5682  else {
5683  __Pyx_RaiseArgtupleInvalid("getLocalNearestNode", 1, 5, 5, 3); __PYX_ERR(0, 254, __pyx_L3_error)
5684  }
5685  CYTHON_FALLTHROUGH;
5686  case 4:
5687  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_node)) != 0)) kw_args--;
5688  else {
5689  __Pyx_RaiseArgtupleInvalid("getLocalNearestNode", 1, 5, 5, 4); __PYX_ERR(0, 254, __pyx_L3_error)
5690  }
5691  }
5692  if (unlikely(kw_args > 0)) {
5693  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getLocalNearestNode") < 0)) __PYX_ERR(0, 254, __pyx_L3_error)
5694  }
5695  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
5696  goto __pyx_L5_argtuple_error;
5697  } else {
5698  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5699  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5700  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5701  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5702  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5703  }
5704  __pyx_v_coords = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coords.memview)) __PYX_ERR(0, 254, __pyx_L3_error)
5705  __pyx_v_nodeArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeArray.memview)) __PYX_ERR(0, 255, __pyx_L3_error)
5706  __pyx_v_nodeStarOffsets = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeStarOffsets.memview)) __PYX_ERR(0, 256, __pyx_L3_error)
5707  __pyx_v_nodeStarArray = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeStarArray.memview)) __PYX_ERR(0, 257, __pyx_L3_error)
5708  __pyx_v_node = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_node == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 258, __pyx_L3_error)
5709  }
5710  goto __pyx_L4_argument_unpacking_done;
5711  __pyx_L5_argtuple_error:;
5712  __Pyx_RaiseArgtupleInvalid("getLocalNearestNode", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 254, __pyx_L3_error)
5713  __pyx_L3_error:;
5714  __Pyx_AddTraceback("mprans.MeshSmoothing.getLocalNearestNode", __pyx_clineno, __pyx_lineno, __pyx_filename);
5715  __Pyx_RefNannyFinishContext();
5716  return NULL;
5717  __pyx_L4_argument_unpacking_done:;
5718  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_24getLocalNearestNode(__pyx_self, __pyx_v_coords, __pyx_v_nodeArray, __pyx_v_nodeStarOffsets, __pyx_v_nodeStarArray, __pyx_v_node);
5719 
5720  /* function exit code */
5721  __Pyx_RefNannyFinishContext();
5722  return __pyx_r;
5723 }
5724 
5725 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_24getLocalNearestNode(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coords, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_nodeStarOffsets, __Pyx_memviewslice __pyx_v_nodeStarArray, int __pyx_v_node) {
5726  PyObject *__pyx_r = NULL;
5727  __Pyx_RefNannyDeclarations
5728  PyObject *__pyx_t_1 = NULL;
5729  __Pyx_RefNannySetupContext("getLocalNearestNode", 0);
5730 
5731  /* "mprans/MeshSmoothing.pyx":279
5732  * nearest node index
5733  * """
5734  * return pyxGetLocalNearestNode(coords, # <<<<<<<<<<<<<<
5735  * nodeArray,
5736  * nodeStarOffsets,
5737  */
5738  __Pyx_XDECREF(__pyx_r);
5739 
5740  /* "mprans/MeshSmoothing.pyx":283
5741  * nodeStarOffsets,
5742  * nodeStarArray,
5743  * node) # <<<<<<<<<<<<<<
5744  *
5745  * def getLocalNearestElement(double[:] coords,
5746  */
5747  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_6mprans_13MeshSmoothing_pyxGetLocalNearestNode(__pyx_v_coords, __pyx_v_nodeArray, __pyx_v_nodeStarOffsets, __pyx_v_nodeStarArray, __pyx_v_node)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 279, __pyx_L1_error)
5748  __Pyx_GOTREF(__pyx_t_1);
5749  __pyx_r = __pyx_t_1;
5750  __pyx_t_1 = 0;
5751  goto __pyx_L0;
5752 
5753  /* "mprans/MeshSmoothing.pyx":254
5754  * apply_directly=False)
5755  *
5756  * def getLocalNearestNode(double[:] coords, # <<<<<<<<<<<<<<
5757  * double[:,:] nodeArray,
5758  * int[:] nodeStarOffsets,
5759  */
5760 
5761  /* function exit code */
5762  __pyx_L1_error:;
5763  __Pyx_XDECREF(__pyx_t_1);
5764  __Pyx_AddTraceback("mprans.MeshSmoothing.getLocalNearestNode", __pyx_clineno, __pyx_lineno, __pyx_filename);
5765  __pyx_r = NULL;
5766  __pyx_L0:;
5767  __PYX_XDEC_MEMVIEW(&__pyx_v_coords, 1);
5768  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray, 1);
5769  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeStarOffsets, 1);
5770  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeStarArray, 1);
5771  __Pyx_XGIVEREF(__pyx_r);
5772  __Pyx_RefNannyFinishContext();
5773  return __pyx_r;
5774 }
5775 
5776 /* "mprans/MeshSmoothing.pyx":285
5777  * node)
5778  *
5779  * def getLocalNearestElement(double[:] coords, # <<<<<<<<<<<<<<
5780  * double[:,:] elementBarycentersArray,
5781  * int[:,:] elementNeighborsArray,
5782  */
5783 
5784 /* Python wrapper */
5785 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_27getLocalNearestElement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5786 static char __pyx_doc_6mprans_13MeshSmoothing_26getLocalNearestElement[] = "Finds nearest element to coordinates (local)\n\n Parameters\n ----------\n coords: double[:]\n coordinates from which to find nearest element\n elementBarycentersArray: double[:,:]\n array of mesh cell barycenter coordinates\n elementNeighborsArray: double[:,:]\n array of element neighbors\n eN: int\n first guess for nearest element\n\n Returns\n -------\n eN: int\n nearest element index\n ";
5787 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_27getLocalNearestElement = {"getLocalNearestElement", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_27getLocalNearestElement, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mprans_13MeshSmoothing_26getLocalNearestElement};
5788 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_27getLocalNearestElement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5789  __Pyx_memviewslice __pyx_v_coords = { 0, 0, { 0 }, { 0 }, { 0 } };
5790  __Pyx_memviewslice __pyx_v_elementBarycentersArray = { 0, 0, { 0 }, { 0 }, { 0 } };
5791  __Pyx_memviewslice __pyx_v_elementNeighborsArray = { 0, 0, { 0 }, { 0 }, { 0 } };
5792  int __pyx_v_eN;
5793  PyObject *__pyx_r = 0;
5794  __Pyx_RefNannyDeclarations
5795  __Pyx_RefNannySetupContext("getLocalNearestElement (wrapper)", 0);
5796  {
5797  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coords,&__pyx_n_s_elementBarycentersArray,&__pyx_n_s_elementNeighborsArray,&__pyx_n_s_eN,0};
5798  PyObject* values[4] = {0,0,0,0};
5799  if (unlikely(__pyx_kwds)) {
5800  Py_ssize_t kw_args;
5801  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5802  switch (pos_args) {
5803  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5804  CYTHON_FALLTHROUGH;
5805  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5806  CYTHON_FALLTHROUGH;
5807  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5808  CYTHON_FALLTHROUGH;
5809  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5810  CYTHON_FALLTHROUGH;
5811  case 0: break;
5812  default: goto __pyx_L5_argtuple_error;
5813  }
5814  kw_args = PyDict_Size(__pyx_kwds);
5815  switch (pos_args) {
5816  case 0:
5817  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coords)) != 0)) kw_args--;
5818  else goto __pyx_L5_argtuple_error;
5819  CYTHON_FALLTHROUGH;
5820  case 1:
5821  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
5822  else {
5823  __Pyx_RaiseArgtupleInvalid("getLocalNearestElement", 1, 4, 4, 1); __PYX_ERR(0, 285, __pyx_L3_error)
5824  }
5825  CYTHON_FALLTHROUGH;
5826  case 2:
5827  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNeighborsArray)) != 0)) kw_args--;
5828  else {
5829  __Pyx_RaiseArgtupleInvalid("getLocalNearestElement", 1, 4, 4, 2); __PYX_ERR(0, 285, __pyx_L3_error)
5830  }
5831  CYTHON_FALLTHROUGH;
5832  case 3:
5833  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_eN)) != 0)) kw_args--;
5834  else {
5835  __Pyx_RaiseArgtupleInvalid("getLocalNearestElement", 1, 4, 4, 3); __PYX_ERR(0, 285, __pyx_L3_error)
5836  }
5837  }
5838  if (unlikely(kw_args > 0)) {
5839  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getLocalNearestElement") < 0)) __PYX_ERR(0, 285, __pyx_L3_error)
5840  }
5841  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
5842  goto __pyx_L5_argtuple_error;
5843  } else {
5844  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5845  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5846  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5847  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5848  }
5849  __pyx_v_coords = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coords.memview)) __PYX_ERR(0, 285, __pyx_L3_error)
5850  __pyx_v_elementBarycentersArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBarycentersArray.memview)) __PYX_ERR(0, 286, __pyx_L3_error)
5851  __pyx_v_elementNeighborsArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementNeighborsArray.memview)) __PYX_ERR(0, 287, __pyx_L3_error)
5852  __pyx_v_eN = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_eN == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 288, __pyx_L3_error)
5853  }
5854  goto __pyx_L4_argument_unpacking_done;
5855  __pyx_L5_argtuple_error:;
5856  __Pyx_RaiseArgtupleInvalid("getLocalNearestElement", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 285, __pyx_L3_error)
5857  __pyx_L3_error:;
5858  __Pyx_AddTraceback("mprans.MeshSmoothing.getLocalNearestElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
5859  __Pyx_RefNannyFinishContext();
5860  return NULL;
5861  __pyx_L4_argument_unpacking_done:;
5862  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_26getLocalNearestElement(__pyx_self, __pyx_v_coords, __pyx_v_elementBarycentersArray, __pyx_v_elementNeighborsArray, __pyx_v_eN);
5863 
5864  /* function exit code */
5865  __Pyx_RefNannyFinishContext();
5866  return __pyx_r;
5867 }
5868 
5869 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_26getLocalNearestElement(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coords, __Pyx_memviewslice __pyx_v_elementBarycentersArray, __Pyx_memviewslice __pyx_v_elementNeighborsArray, int __pyx_v_eN) {
5870  PyObject *__pyx_r = NULL;
5871  __Pyx_RefNannyDeclarations
5872  PyObject *__pyx_t_1 = NULL;
5873  __Pyx_RefNannySetupContext("getLocalNearestElement", 0);
5874 
5875  /* "mprans/MeshSmoothing.pyx":307
5876  * nearest element index
5877  * """
5878  * return pyxGetLocalNearestElement(coords, # <<<<<<<<<<<<<<
5879  * elementBarycentersArray,
5880  * elementNeighborsArray,
5881  */
5882  __Pyx_XDECREF(__pyx_r);
5883 
5884  /* "mprans/MeshSmoothing.pyx":310
5885  * elementBarycentersArray,
5886  * elementNeighborsArray,
5887  * eN) # <<<<<<<<<<<<<<
5888  *
5889  * def getLocalNearestElementAroundNode(double[:] coords,
5890  */
5891  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_6mprans_13MeshSmoothing_pyxGetLocalNearestElement(__pyx_v_coords, __pyx_v_elementBarycentersArray, __pyx_v_elementNeighborsArray, __pyx_v_eN)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 307, __pyx_L1_error)
5892  __Pyx_GOTREF(__pyx_t_1);
5893  __pyx_r = __pyx_t_1;
5894  __pyx_t_1 = 0;
5895  goto __pyx_L0;
5896 
5897  /* "mprans/MeshSmoothing.pyx":285
5898  * node)
5899  *
5900  * def getLocalNearestElement(double[:] coords, # <<<<<<<<<<<<<<
5901  * double[:,:] elementBarycentersArray,
5902  * int[:,:] elementNeighborsArray,
5903  */
5904 
5905  /* function exit code */
5906  __pyx_L1_error:;
5907  __Pyx_XDECREF(__pyx_t_1);
5908  __Pyx_AddTraceback("mprans.MeshSmoothing.getLocalNearestElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
5909  __pyx_r = NULL;
5910  __pyx_L0:;
5911  __PYX_XDEC_MEMVIEW(&__pyx_v_coords, 1);
5912  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBarycentersArray, 1);
5913  __PYX_XDEC_MEMVIEW(&__pyx_v_elementNeighborsArray, 1);
5914  __Pyx_XGIVEREF(__pyx_r);
5915  __Pyx_RefNannyFinishContext();
5916  return __pyx_r;
5917 }
5918 
5919 /* "mprans/MeshSmoothing.pyx":312
5920  * eN)
5921  *
5922  * def getLocalNearestElementAroundNode(double[:] coords, # <<<<<<<<<<<<<<
5923  * int[:] nodeElementOffsets,
5924  * int[:] nodeElementsArray,
5925  */
5926 
5927 /* Python wrapper */
5928 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_29getLocalNearestElementAroundNode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5929 static char __pyx_doc_6mprans_13MeshSmoothing_28getLocalNearestElementAroundNode[] = "Finds nearest neighbouring element of node to coordinates (local)\n\n Parameters\n ----------\n coords: double[:]\n coordinates from which to find nearest element\n nodeElementOffsets: int[:]\n element offsets from nodes\n nodeElementsArray: int[:]\n elements array from nodeElementOffsets\n elementBarycentersArray: int[:]\n array of mesh cell barycenter coordinates\n node: int\n node from which to search\n\n Returns\n -------\n eN: int\n nearest element index\n ";
5930 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_29getLocalNearestElementAroundNode = {"getLocalNearestElementAroundNode", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_29getLocalNearestElementAroundNode, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mprans_13MeshSmoothing_28getLocalNearestElementAroundNode};
5931 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_29getLocalNearestElementAroundNode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5932  __Pyx_memviewslice __pyx_v_coords = { 0, 0, { 0 }, { 0 }, { 0 } };
5933  __Pyx_memviewslice __pyx_v_nodeElementOffsets = { 0, 0, { 0 }, { 0 }, { 0 } };
5934  __Pyx_memviewslice __pyx_v_nodeElementsArray = { 0, 0, { 0 }, { 0 }, { 0 } };
5935  __Pyx_memviewslice __pyx_v_elementBarycentersArray = { 0, 0, { 0 }, { 0 }, { 0 } };
5936  int __pyx_v_node;
5937  PyObject *__pyx_r = 0;
5938  __Pyx_RefNannyDeclarations
5939  __Pyx_RefNannySetupContext("getLocalNearestElementAroundNode (wrapper)", 0);
5940  {
5941  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coords,&__pyx_n_s_nodeElementOffsets,&__pyx_n_s_nodeElementsArray,&__pyx_n_s_elementBarycentersArray,&__pyx_n_s_node,0};
5942  PyObject* values[5] = {0,0,0,0,0};
5943  if (unlikely(__pyx_kwds)) {
5944  Py_ssize_t kw_args;
5945  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5946  switch (pos_args) {
5947  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5948  CYTHON_FALLTHROUGH;
5949  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5950  CYTHON_FALLTHROUGH;
5951  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5952  CYTHON_FALLTHROUGH;
5953  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5954  CYTHON_FALLTHROUGH;
5955  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5956  CYTHON_FALLTHROUGH;
5957  case 0: break;
5958  default: goto __pyx_L5_argtuple_error;
5959  }
5960  kw_args = PyDict_Size(__pyx_kwds);
5961  switch (pos_args) {
5962  case 0:
5963  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coords)) != 0)) kw_args--;
5964  else goto __pyx_L5_argtuple_error;
5965  CYTHON_FALLTHROUGH;
5966  case 1:
5967  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementOffsets)) != 0)) kw_args--;
5968  else {
5969  __Pyx_RaiseArgtupleInvalid("getLocalNearestElementAroundNode", 1, 5, 5, 1); __PYX_ERR(0, 312, __pyx_L3_error)
5970  }
5971  CYTHON_FALLTHROUGH;
5972  case 2:
5973  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementsArray)) != 0)) kw_args--;
5974  else {
5975  __Pyx_RaiseArgtupleInvalid("getLocalNearestElementAroundNode", 1, 5, 5, 2); __PYX_ERR(0, 312, __pyx_L3_error)
5976  }
5977  CYTHON_FALLTHROUGH;
5978  case 3:
5979  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
5980  else {
5981  __Pyx_RaiseArgtupleInvalid("getLocalNearestElementAroundNode", 1, 5, 5, 3); __PYX_ERR(0, 312, __pyx_L3_error)
5982  }
5983  CYTHON_FALLTHROUGH;
5984  case 4:
5985  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_node)) != 0)) kw_args--;
5986  else {
5987  __Pyx_RaiseArgtupleInvalid("getLocalNearestElementAroundNode", 1, 5, 5, 4); __PYX_ERR(0, 312, __pyx_L3_error)
5988  }
5989  }
5990  if (unlikely(kw_args > 0)) {
5991  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getLocalNearestElementAroundNode") < 0)) __PYX_ERR(0, 312, __pyx_L3_error)
5992  }
5993  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
5994  goto __pyx_L5_argtuple_error;
5995  } else {
5996  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5997  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5998  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5999  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6000  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6001  }
6002  __pyx_v_coords = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coords.memview)) __PYX_ERR(0, 312, __pyx_L3_error)
6003  __pyx_v_nodeElementOffsets = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementOffsets.memview)) __PYX_ERR(0, 313, __pyx_L3_error)
6004  __pyx_v_nodeElementsArray = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementsArray.memview)) __PYX_ERR(0, 314, __pyx_L3_error)
6005  __pyx_v_elementBarycentersArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBarycentersArray.memview)) __PYX_ERR(0, 315, __pyx_L3_error)
6006  __pyx_v_node = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_node == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 316, __pyx_L3_error)
6007  }
6008  goto __pyx_L4_argument_unpacking_done;
6009  __pyx_L5_argtuple_error:;
6010  __Pyx_RaiseArgtupleInvalid("getLocalNearestElementAroundNode", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 312, __pyx_L3_error)
6011  __pyx_L3_error:;
6012  __Pyx_AddTraceback("mprans.MeshSmoothing.getLocalNearestElementAroundNode", __pyx_clineno, __pyx_lineno, __pyx_filename);
6013  __Pyx_RefNannyFinishContext();
6014  return NULL;
6015  __pyx_L4_argument_unpacking_done:;
6016  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_28getLocalNearestElementAroundNode(__pyx_self, __pyx_v_coords, __pyx_v_nodeElementOffsets, __pyx_v_nodeElementsArray, __pyx_v_elementBarycentersArray, __pyx_v_node);
6017 
6018  /* function exit code */
6019  __Pyx_RefNannyFinishContext();
6020  return __pyx_r;
6021 }
6022 
6023 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_28getLocalNearestElementAroundNode(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coords, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_elementBarycentersArray, int __pyx_v_node) {
6024  PyObject *__pyx_r = NULL;
6025  __Pyx_RefNannyDeclarations
6026  PyObject *__pyx_t_1 = NULL;
6027  __Pyx_RefNannySetupContext("getLocalNearestElementAroundNode", 0);
6028 
6029  /* "mprans/MeshSmoothing.pyx":337
6030  * nearest element index
6031  * """
6032  * return pyxGetLocalNearestElementAroundNode(coords=coords, # <<<<<<<<<<<<<<
6033  * nodeElementOffsets=nodeElementOffsets,
6034  * nodeElementsArray=nodeElementsArray,
6035  */
6036  __Pyx_XDECREF(__pyx_r);
6037 
6038  /* "mprans/MeshSmoothing.pyx":341
6039  * nodeElementsArray=nodeElementsArray,
6040  * elementBarycentersArray=elementBarycentersArray,
6041  * node=node) # <<<<<<<<<<<<<<
6042  *
6043  * def getLocalNearestElementIntersection(double[:] coords,
6044  */
6045  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_6mprans_13MeshSmoothing_pyxGetLocalNearestElementAroundNode(__pyx_v_coords, __pyx_v_nodeElementOffsets, __pyx_v_nodeElementsArray, __pyx_v_elementBarycentersArray, __pyx_v_node)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 337, __pyx_L1_error)
6046  __Pyx_GOTREF(__pyx_t_1);
6047  __pyx_r = __pyx_t_1;
6048  __pyx_t_1 = 0;
6049  goto __pyx_L0;
6050 
6051  /* "mprans/MeshSmoothing.pyx":312
6052  * eN)
6053  *
6054  * def getLocalNearestElementAroundNode(double[:] coords, # <<<<<<<<<<<<<<
6055  * int[:] nodeElementOffsets,
6056  * int[:] nodeElementsArray,
6057  */
6058 
6059  /* function exit code */
6060  __pyx_L1_error:;
6061  __Pyx_XDECREF(__pyx_t_1);
6062  __Pyx_AddTraceback("mprans.MeshSmoothing.getLocalNearestElementAroundNode", __pyx_clineno, __pyx_lineno, __pyx_filename);
6063  __pyx_r = NULL;
6064  __pyx_L0:;
6065  __PYX_XDEC_MEMVIEW(&__pyx_v_coords, 1);
6066  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementOffsets, 1);
6067  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementsArray, 1);
6068  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBarycentersArray, 1);
6069  __Pyx_XGIVEREF(__pyx_r);
6070  __Pyx_RefNannyFinishContext();
6071  return __pyx_r;
6072 }
6073 
6074 /* "mprans/MeshSmoothing.pyx":343
6075  * node=node)
6076  *
6077  * def getLocalNearestElementIntersection(double[:] coords, # <<<<<<<<<<<<<<
6078  * double[:] starting_coords,
6079  * double[:,:,:] elementBoundaryNormalsArray,
6080  */
6081 
6082 /* Python wrapper */
6083 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_31getLocalNearestElementIntersection(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6084 static char __pyx_doc_6mprans_13MeshSmoothing_30getLocalNearestElementIntersection[] = "Find element nearest or containing coords through element boundary intersection\n\n Parameters\n ----------\n coords: double[:]\n coordinates of point for which a containing element must be found\n starting_coords: double[:]\n starting coords to look for coords\n elementBoundaryNormals: double[:,:,:]\n normals of the element boundaries\n elementBoundariesArray: int[:,:]\n index of boundaries per elements\n elementBoundaryBarycentersArray: int[:,:]\n barycenters of element boundaries\n elementBoundaryElementsArray: int[:,:]\n array of elements shared by boundaries\n exteriorElementBoundariesBoolArray: int[:]\n boolean array of exterior element boundaries (1: is exterior boundary)\n must be same length as the number of element boundaries\n eN: first guess of element\n\n Returns\n -------\n nearest_eN: int\n nearest element to coords (-1 if element at border)\n b_i_last: int\n last element boundary crossed\n ";
6085 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_31getLocalNearestElementIntersection = {"getLocalNearestElementIntersection", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_31getLocalNearestElementIntersection, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mprans_13MeshSmoothing_30getLocalNearestElementIntersection};
6086 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_31getLocalNearestElementIntersection(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6087  __Pyx_memviewslice __pyx_v_coords = { 0, 0, { 0 }, { 0 }, { 0 } };
6088  __Pyx_memviewslice __pyx_v_starting_coords = { 0, 0, { 0 }, { 0 }, { 0 } };
6089  __Pyx_memviewslice __pyx_v_elementBoundaryNormalsArray = { 0, 0, { 0 }, { 0 }, { 0 } };
6090  __Pyx_memviewslice __pyx_v_elementBoundariesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
6091  __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray = { 0, 0, { 0 }, { 0 }, { 0 } };
6092  __Pyx_memviewslice __pyx_v_elementBoundaryElementsArray = { 0, 0, { 0 }, { 0 }, { 0 } };
6093  __Pyx_memviewslice __pyx_v_exteriorElementBoundariesBoolArray = { 0, 0, { 0 }, { 0 }, { 0 } };
6094  int __pyx_v_eN;
6095  PyObject *__pyx_r = 0;
6096  __Pyx_RefNannyDeclarations
6097  __Pyx_RefNannySetupContext("getLocalNearestElementIntersection (wrapper)", 0);
6098  {
6099  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coords,&__pyx_n_s_starting_coords,&__pyx_n_s_elementBoundaryNormalsArray,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryBarycentersArray,&__pyx_n_s_elementBoundaryElementsArray,&__pyx_n_s_exteriorElementBoundariesBoolArr,&__pyx_n_s_eN,0};
6100  PyObject* values[8] = {0,0,0,0,0,0,0,0};
6101  if (unlikely(__pyx_kwds)) {
6102  Py_ssize_t kw_args;
6103  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6104  switch (pos_args) {
6105  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
6106  CYTHON_FALLTHROUGH;
6107  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
6108  CYTHON_FALLTHROUGH;
6109  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6110  CYTHON_FALLTHROUGH;
6111  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6112  CYTHON_FALLTHROUGH;
6113  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6114  CYTHON_FALLTHROUGH;
6115  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6116  CYTHON_FALLTHROUGH;
6117  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6118  CYTHON_FALLTHROUGH;
6119  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6120  CYTHON_FALLTHROUGH;
6121  case 0: break;
6122  default: goto __pyx_L5_argtuple_error;
6123  }
6124  kw_args = PyDict_Size(__pyx_kwds);
6125  switch (pos_args) {
6126  case 0:
6127  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coords)) != 0)) kw_args--;
6128  else goto __pyx_L5_argtuple_error;
6129  CYTHON_FALLTHROUGH;
6130  case 1:
6131  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_starting_coords)) != 0)) kw_args--;
6132  else {
6133  __Pyx_RaiseArgtupleInvalid("getLocalNearestElementIntersection", 1, 8, 8, 1); __PYX_ERR(0, 343, __pyx_L3_error)
6134  }
6135  CYTHON_FALLTHROUGH;
6136  case 2:
6137  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryNormalsArray)) != 0)) kw_args--;
6138  else {
6139  __Pyx_RaiseArgtupleInvalid("getLocalNearestElementIntersection", 1, 8, 8, 2); __PYX_ERR(0, 343, __pyx_L3_error)
6140  }
6141  CYTHON_FALLTHROUGH;
6142  case 3:
6143  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
6144  else {
6145  __Pyx_RaiseArgtupleInvalid("getLocalNearestElementIntersection", 1, 8, 8, 3); __PYX_ERR(0, 343, __pyx_L3_error)
6146  }
6147  CYTHON_FALLTHROUGH;
6148  case 4:
6149  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryBarycentersArray)) != 0)) kw_args--;
6150  else {
6151  __Pyx_RaiseArgtupleInvalid("getLocalNearestElementIntersection", 1, 8, 8, 4); __PYX_ERR(0, 343, __pyx_L3_error)
6152  }
6153  CYTHON_FALLTHROUGH;
6154  case 5:
6155  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryElementsArray)) != 0)) kw_args--;
6156  else {
6157  __Pyx_RaiseArgtupleInvalid("getLocalNearestElementIntersection", 1, 8, 8, 5); __PYX_ERR(0, 343, __pyx_L3_error)
6158  }
6159  CYTHON_FALLTHROUGH;
6160  case 6:
6161  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exteriorElementBoundariesBoolArr)) != 0)) kw_args--;
6162  else {
6163  __Pyx_RaiseArgtupleInvalid("getLocalNearestElementIntersection", 1, 8, 8, 6); __PYX_ERR(0, 343, __pyx_L3_error)
6164  }
6165  CYTHON_FALLTHROUGH;
6166  case 7:
6167  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_eN)) != 0)) kw_args--;
6168  else {
6169  __Pyx_RaiseArgtupleInvalid("getLocalNearestElementIntersection", 1, 8, 8, 7); __PYX_ERR(0, 343, __pyx_L3_error)
6170  }
6171  }
6172  if (unlikely(kw_args > 0)) {
6173  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getLocalNearestElementIntersection") < 0)) __PYX_ERR(0, 343, __pyx_L3_error)
6174  }
6175  } else if (PyTuple_GET_SIZE(__pyx_args) != 8) {
6176  goto __pyx_L5_argtuple_error;
6177  } else {
6178  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6179  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6180  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6181  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6182  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6183  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6184  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
6185  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
6186  }
6187  __pyx_v_coords = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coords.memview)) __PYX_ERR(0, 343, __pyx_L3_error)
6188  __pyx_v_starting_coords = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_starting_coords.memview)) __PYX_ERR(0, 344, __pyx_L3_error)
6189  __pyx_v_elementBoundaryNormalsArray = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundaryNormalsArray.memview)) __PYX_ERR(0, 345, __pyx_L3_error)
6190  __pyx_v_elementBoundariesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundariesArray.memview)) __PYX_ERR(0, 346, __pyx_L3_error)
6191  __pyx_v_elementBoundaryBarycentersArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundaryBarycentersArray.memview)) __PYX_ERR(0, 347, __pyx_L3_error)
6192  __pyx_v_elementBoundaryElementsArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundaryElementsArray.memview)) __PYX_ERR(0, 348, __pyx_L3_error)
6193  __pyx_v_exteriorElementBoundariesBoolArray = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_exteriorElementBoundariesBoolArray.memview)) __PYX_ERR(0, 349, __pyx_L3_error)
6194  __pyx_v_eN = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_eN == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 350, __pyx_L3_error)
6195  }
6196  goto __pyx_L4_argument_unpacking_done;
6197  __pyx_L5_argtuple_error:;
6198  __Pyx_RaiseArgtupleInvalid("getLocalNearestElementIntersection", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 343, __pyx_L3_error)
6199  __pyx_L3_error:;
6200  __Pyx_AddTraceback("mprans.MeshSmoothing.getLocalNearestElementIntersection", __pyx_clineno, __pyx_lineno, __pyx_filename);
6201  __Pyx_RefNannyFinishContext();
6202  return NULL;
6203  __pyx_L4_argument_unpacking_done:;
6204  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_30getLocalNearestElementIntersection(__pyx_self, __pyx_v_coords, __pyx_v_starting_coords, __pyx_v_elementBoundaryNormalsArray, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryBarycentersArray, __pyx_v_elementBoundaryElementsArray, __pyx_v_exteriorElementBoundariesBoolArray, __pyx_v_eN);
6205 
6206  /* function exit code */
6207  __Pyx_RefNannyFinishContext();
6208  return __pyx_r;
6209 }
6210 
6211 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_30getLocalNearestElementIntersection(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coords, __Pyx_memviewslice __pyx_v_starting_coords, __Pyx_memviewslice __pyx_v_elementBoundaryNormalsArray, __Pyx_memviewslice __pyx_v_elementBoundariesArray, __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray, __Pyx_memviewslice __pyx_v_elementBoundaryElementsArray, __Pyx_memviewslice __pyx_v_exteriorElementBoundariesBoolArray, int __pyx_v_eN) {
6212  PyObject *__pyx_r = NULL;
6213  __Pyx_RefNannyDeclarations
6214  __Pyx_memviewslice __pyx_t_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
6215  PyObject *__pyx_t_2 = NULL;
6216  __Pyx_RefNannySetupContext("getLocalNearestElementIntersection", 0);
6217 
6218  /* "mprans/MeshSmoothing.pyx":379
6219  * last element boundary crossed
6220  * """
6221  * return pyxGetLocalNearestElementIntersection(coords=coords, # <<<<<<<<<<<<<<
6222  * starting_coords=starting_coords,
6223  * elementBoundaryNormalsArray=elementBoundaryNormalsArray,
6224  */
6225  __Pyx_XDECREF(__pyx_r);
6226 
6227  /* "mprans/MeshSmoothing.pyx":386
6228  * elementBoundaryElementsArray=elementBoundaryElementsArray,
6229  * exteriorElementBoundariesBoolArray=exteriorElementBoundariesBoolArray,
6230  * eN=eN) # <<<<<<<<<<<<<<
6231  *
6232  * def getLocalElement(femSpace,
6233  */
6234  __pyx_t_1 = __pyx_f_6mprans_13MeshSmoothing_pyxGetLocalNearestElementIntersection(__pyx_v_coords, __pyx_v_starting_coords, __pyx_v_elementBoundaryNormalsArray, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryBarycentersArray, __pyx_v_elementBoundaryElementsArray, __pyx_v_exteriorElementBoundariesBoolArray, __pyx_v_eN); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 379, __pyx_L1_error)
6235 
6236  /* "mprans/MeshSmoothing.pyx":379
6237  * last element boundary crossed
6238  * """
6239  * return pyxGetLocalNearestElementIntersection(coords=coords, # <<<<<<<<<<<<<<
6240  * starting_coords=starting_coords,
6241  * elementBoundaryNormalsArray=elementBoundaryNormalsArray,
6242  */
6243  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_t_1, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 379, __pyx_L1_error)
6244  __Pyx_GOTREF(__pyx_t_2);
6245  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
6246  __pyx_t_1.memview = NULL;
6247  __pyx_t_1.data = NULL;
6248  __pyx_r = __pyx_t_2;
6249  __pyx_t_2 = 0;
6250  goto __pyx_L0;
6251 
6252  /* "mprans/MeshSmoothing.pyx":343
6253  * node=node)
6254  *
6255  * def getLocalNearestElementIntersection(double[:] coords, # <<<<<<<<<<<<<<
6256  * double[:] starting_coords,
6257  * double[:,:,:] elementBoundaryNormalsArray,
6258  */
6259 
6260  /* function exit code */
6261  __pyx_L1_error:;
6262  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
6263  __Pyx_XDECREF(__pyx_t_2);
6264  __Pyx_AddTraceback("mprans.MeshSmoothing.getLocalNearestElementIntersection", __pyx_clineno, __pyx_lineno, __pyx_filename);
6265  __pyx_r = NULL;
6266  __pyx_L0:;
6267  __PYX_XDEC_MEMVIEW(&__pyx_v_coords, 1);
6268  __PYX_XDEC_MEMVIEW(&__pyx_v_starting_coords, 1);
6269  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundaryNormalsArray, 1);
6270  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundariesArray, 1);
6271  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundaryBarycentersArray, 1);
6272  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundaryElementsArray, 1);
6273  __PYX_XDEC_MEMVIEW(&__pyx_v_exteriorElementBoundariesBoolArray, 1);
6274  __Pyx_XGIVEREF(__pyx_r);
6275  __Pyx_RefNannyFinishContext();
6276  return __pyx_r;
6277 }
6278 
6279 /* "mprans/MeshSmoothing.pyx":388
6280  * eN=eN)
6281  *
6282  * def getLocalElement(femSpace, # <<<<<<<<<<<<<<
6283  * coords,
6284  * node):
6285  */
6286 
6287 /* Python wrapper */
6288 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_33getLocalElement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6289 static char __pyx_doc_6mprans_13MeshSmoothing_32getLocalElement[] = "Given coordinates and its nearest node, determine if it is on a\n local element.\n (!) old implementation -> slow\n\n Parameters\n ----------\n femSpace: object\n finite element space\n coords: array_like\n coordinates from which to element\n node: int\n nearest node index\n\n Returns\n -------\n eN: int or None\n local index of element (None if not found)\n ";
6290 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_33getLocalElement = {"getLocalElement", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_33getLocalElement, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mprans_13MeshSmoothing_32getLocalElement};
6291 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_33getLocalElement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6292  PyObject *__pyx_v_femSpace = 0;
6293  PyObject *__pyx_v_coords = 0;
6294  PyObject *__pyx_v_node = 0;
6295  PyObject *__pyx_r = 0;
6296  __Pyx_RefNannyDeclarations
6297  __Pyx_RefNannySetupContext("getLocalElement (wrapper)", 0);
6298  {
6299  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_femSpace,&__pyx_n_s_coords,&__pyx_n_s_node,0};
6300  PyObject* values[3] = {0,0,0};
6301  if (unlikely(__pyx_kwds)) {
6302  Py_ssize_t kw_args;
6303  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6304  switch (pos_args) {
6305  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6306  CYTHON_FALLTHROUGH;
6307  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6308  CYTHON_FALLTHROUGH;
6309  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6310  CYTHON_FALLTHROUGH;
6311  case 0: break;
6312  default: goto __pyx_L5_argtuple_error;
6313  }
6314  kw_args = PyDict_Size(__pyx_kwds);
6315  switch (pos_args) {
6316  case 0:
6317  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_femSpace)) != 0)) kw_args--;
6318  else goto __pyx_L5_argtuple_error;
6319  CYTHON_FALLTHROUGH;
6320  case 1:
6321  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coords)) != 0)) kw_args--;
6322  else {
6323  __Pyx_RaiseArgtupleInvalid("getLocalElement", 1, 3, 3, 1); __PYX_ERR(0, 388, __pyx_L3_error)
6324  }
6325  CYTHON_FALLTHROUGH;
6326  case 2:
6327  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_node)) != 0)) kw_args--;
6328  else {
6329  __Pyx_RaiseArgtupleInvalid("getLocalElement", 1, 3, 3, 2); __PYX_ERR(0, 388, __pyx_L3_error)
6330  }
6331  }
6332  if (unlikely(kw_args > 0)) {
6333  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getLocalElement") < 0)) __PYX_ERR(0, 388, __pyx_L3_error)
6334  }
6335  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
6336  goto __pyx_L5_argtuple_error;
6337  } else {
6338  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6339  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6340  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6341  }
6342  __pyx_v_femSpace = values[0];
6343  __pyx_v_coords = values[1];
6344  __pyx_v_node = values[2];
6345  }
6346  goto __pyx_L4_argument_unpacking_done;
6347  __pyx_L5_argtuple_error:;
6348  __Pyx_RaiseArgtupleInvalid("getLocalElement", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 388, __pyx_L3_error)
6349  __pyx_L3_error:;
6350  __Pyx_AddTraceback("mprans.MeshSmoothing.getLocalElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
6351  __Pyx_RefNannyFinishContext();
6352  return NULL;
6353  __pyx_L4_argument_unpacking_done:;
6354  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_32getLocalElement(__pyx_self, __pyx_v_femSpace, __pyx_v_coords, __pyx_v_node);
6355 
6356  /* function exit code */
6357  __Pyx_RefNannyFinishContext();
6358  return __pyx_r;
6359 }
6360 
6361 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_32getLocalElement(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_femSpace, PyObject *__pyx_v_coords, PyObject *__pyx_v_node) {
6362  PyObject *__pyx_v_patchBoundaryNodes = NULL;
6363  PyObject *__pyx_v_checkedElements = NULL;
6364  PyObject *__pyx_v_eOffset = NULL;
6365  PyObject *__pyx_v_eN = NULL;
6366  PyObject *__pyx_v_xi = NULL;
6367  PyObject *__pyx_r = NULL;
6368  __Pyx_RefNannyDeclarations
6369  PyObject *__pyx_t_1 = NULL;
6370  PyObject *__pyx_t_2 = NULL;
6371  PyObject *__pyx_t_3 = NULL;
6372  Py_ssize_t __pyx_t_4;
6373  int __pyx_t_5;
6374  PyObject *__pyx_t_6 = NULL;
6375  PyObject *(*__pyx_t_7)(PyObject *);
6376  int __pyx_t_8;
6377  int __pyx_t_9;
6378  PyObject *__pyx_t_10 = NULL;
6379  Py_ssize_t __pyx_t_11;
6380  int __pyx_t_12;
6381  Py_ssize_t __pyx_t_13;
6382  int __pyx_t_14;
6383  PyObject *__pyx_t_15 = NULL;
6384  __Pyx_RefNannySetupContext("getLocalElement", 0);
6385  __Pyx_INCREF(__pyx_v_node);
6386 
6387  /* "mprans/MeshSmoothing.pyx":409
6388  * local index of element (None if not found)
6389  * """
6390  * patchBoundaryNodes=set() # <<<<<<<<<<<<<<
6391  * checkedElements=[]
6392  * # nodeElementOffsets give the indices to get the elements sharing the node
6393  */
6394  __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 409, __pyx_L1_error)
6395  __Pyx_GOTREF(__pyx_t_1);
6396  __pyx_v_patchBoundaryNodes = ((PyObject*)__pyx_t_1);
6397  __pyx_t_1 = 0;
6398 
6399  /* "mprans/MeshSmoothing.pyx":410
6400  * """
6401  * patchBoundaryNodes=set()
6402  * checkedElements=[] # <<<<<<<<<<<<<<
6403  * # nodeElementOffsets give the indices to get the elements sharing the node
6404  * #log Profiling.logEvent("Getting Local Element")
6405  */
6406  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 410, __pyx_L1_error)
6407  __Pyx_GOTREF(__pyx_t_1);
6408  __pyx_v_checkedElements = ((PyObject*)__pyx_t_1);
6409  __pyx_t_1 = 0;
6410 
6411  /* "mprans/MeshSmoothing.pyx":413
6412  * # nodeElementOffsets give the indices to get the elements sharing the node
6413  * #log Profiling.logEvent("Getting Local Element")
6414  * if node+1 < len(femSpace.mesh.nodeElementOffsets): # <<<<<<<<<<<<<<
6415  * for eOffset in range(femSpace.mesh.nodeElementOffsets[node], femSpace.mesh.nodeElementOffsets[node + 1]):
6416  * eN = femSpace.mesh.nodeElementsArray[eOffset]
6417  */
6418  __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_v_node, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 413, __pyx_L1_error)
6419  __Pyx_GOTREF(__pyx_t_1);
6420  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_femSpace, __pyx_n_s_mesh); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 413, __pyx_L1_error)
6421  __Pyx_GOTREF(__pyx_t_2);
6422  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_nodeElementOffsets); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 413, __pyx_L1_error)
6423  __Pyx_GOTREF(__pyx_t_3);
6424  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6425  __pyx_t_4 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 413, __pyx_L1_error)
6426  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6427  __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 413, __pyx_L1_error)
6428  __Pyx_GOTREF(__pyx_t_3);
6429  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 413, __pyx_L1_error)
6430  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6431  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6432  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 413, __pyx_L1_error)
6433  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6434  if (__pyx_t_5) {
6435 
6436  /* "mprans/MeshSmoothing.pyx":414
6437  * #log Profiling.logEvent("Getting Local Element")
6438  * if node+1 < len(femSpace.mesh.nodeElementOffsets):
6439  * for eOffset in range(femSpace.mesh.nodeElementOffsets[node], femSpace.mesh.nodeElementOffsets[node + 1]): # <<<<<<<<<<<<<<
6440  * eN = femSpace.mesh.nodeElementsArray[eOffset]
6441  * checkedElements.append(eN)
6442  */
6443  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_femSpace, __pyx_n_s_mesh); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 414, __pyx_L1_error)
6444  __Pyx_GOTREF(__pyx_t_2);
6445  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_nodeElementOffsets); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 414, __pyx_L1_error)
6446  __Pyx_GOTREF(__pyx_t_3);
6447  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6448  __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_v_node); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 414, __pyx_L1_error)
6449  __Pyx_GOTREF(__pyx_t_2);
6450  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6451  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_femSpace, __pyx_n_s_mesh); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 414, __pyx_L1_error)
6452  __Pyx_GOTREF(__pyx_t_3);
6453  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_nodeElementOffsets); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 414, __pyx_L1_error)
6454  __Pyx_GOTREF(__pyx_t_1);
6455  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6456  __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_node, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 414, __pyx_L1_error)
6457  __Pyx_GOTREF(__pyx_t_3);
6458  __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 414, __pyx_L1_error)
6459  __Pyx_GOTREF(__pyx_t_6);
6460  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6461  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6462  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 414, __pyx_L1_error)
6463  __Pyx_GOTREF(__pyx_t_3);
6464  __Pyx_GIVEREF(__pyx_t_2);
6465  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
6466  __Pyx_GIVEREF(__pyx_t_6);
6467  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_6);
6468  __pyx_t_2 = 0;
6469  __pyx_t_6 = 0;
6470  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 414, __pyx_L1_error)
6471  __Pyx_GOTREF(__pyx_t_6);
6472  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6473  if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) {
6474  __pyx_t_3 = __pyx_t_6; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
6475  __pyx_t_7 = NULL;
6476  } else {
6477  __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 414, __pyx_L1_error)
6478  __Pyx_GOTREF(__pyx_t_3);
6479  __pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 414, __pyx_L1_error)
6480  }
6481  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6482  for (;;) {
6483  if (likely(!__pyx_t_7)) {
6484  if (likely(PyList_CheckExact(__pyx_t_3))) {
6485  if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
6486  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6487  __pyx_t_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 414, __pyx_L1_error)
6488  #else
6489  __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 414, __pyx_L1_error)
6490  __Pyx_GOTREF(__pyx_t_6);
6491  #endif
6492  } else {
6493  if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
6494  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6495  __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 414, __pyx_L1_error)
6496  #else
6497  __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 414, __pyx_L1_error)
6498  __Pyx_GOTREF(__pyx_t_6);
6499  #endif
6500  }
6501  } else {
6502  __pyx_t_6 = __pyx_t_7(__pyx_t_3);
6503  if (unlikely(!__pyx_t_6)) {
6504  PyObject* exc_type = PyErr_Occurred();
6505  if (exc_type) {
6506  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
6507  else __PYX_ERR(0, 414, __pyx_L1_error)
6508  }
6509  break;
6510  }
6511  __Pyx_GOTREF(__pyx_t_6);
6512  }
6513  __Pyx_XDECREF_SET(__pyx_v_eOffset, __pyx_t_6);
6514  __pyx_t_6 = 0;
6515 
6516  /* "mprans/MeshSmoothing.pyx":415
6517  * if node+1 < len(femSpace.mesh.nodeElementOffsets):
6518  * for eOffset in range(femSpace.mesh.nodeElementOffsets[node], femSpace.mesh.nodeElementOffsets[node + 1]):
6519  * eN = femSpace.mesh.nodeElementsArray[eOffset] # <<<<<<<<<<<<<<
6520  * checkedElements.append(eN)
6521  * # union of set
6522  */
6523  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_femSpace, __pyx_n_s_mesh); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 415, __pyx_L1_error)
6524  __Pyx_GOTREF(__pyx_t_6);
6525  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_nodeElementsArray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 415, __pyx_L1_error)
6526  __Pyx_GOTREF(__pyx_t_2);
6527  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6528  __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_eOffset); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 415, __pyx_L1_error)
6529  __Pyx_GOTREF(__pyx_t_6);
6530  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6531  __Pyx_XDECREF_SET(__pyx_v_eN, __pyx_t_6);
6532  __pyx_t_6 = 0;
6533 
6534  /* "mprans/MeshSmoothing.pyx":416
6535  * for eOffset in range(femSpace.mesh.nodeElementOffsets[node], femSpace.mesh.nodeElementOffsets[node + 1]):
6536  * eN = femSpace.mesh.nodeElementsArray[eOffset]
6537  * checkedElements.append(eN) # <<<<<<<<<<<<<<
6538  * # union of set
6539  * patchBoundaryNodes|=set(femSpace.mesh.elementNodesArray[eN])
6540  */
6541  __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_checkedElements, __pyx_v_eN); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 416, __pyx_L1_error)
6542 
6543  /* "mprans/MeshSmoothing.pyx":418
6544  * checkedElements.append(eN)
6545  * # union of set
6546  * patchBoundaryNodes|=set(femSpace.mesh.elementNodesArray[eN]) # <<<<<<<<<<<<<<
6547  * # evaluate the inverse map for element eN (global to local)
6548  * xi = femSpace.elementMaps.getInverseValue(eN, coords)
6549  */
6550  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_femSpace, __pyx_n_s_mesh); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 418, __pyx_L1_error)
6551  __Pyx_GOTREF(__pyx_t_6);
6552  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_elementNodesArray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 418, __pyx_L1_error)
6553  __Pyx_GOTREF(__pyx_t_2);
6554  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6555  __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_eN); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 418, __pyx_L1_error)
6556  __Pyx_GOTREF(__pyx_t_6);
6557  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6558  __pyx_t_2 = PySet_New(__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 418, __pyx_L1_error)
6559  __Pyx_GOTREF(__pyx_t_2);
6560  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6561  __pyx_t_6 = PyNumber_InPlaceOr(__pyx_v_patchBoundaryNodes, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 418, __pyx_L1_error)
6562  __Pyx_GOTREF(__pyx_t_6);
6563  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6564  __Pyx_DECREF_SET(__pyx_v_patchBoundaryNodes, ((PyObject*)__pyx_t_6));
6565  __pyx_t_6 = 0;
6566 
6567  /* "mprans/MeshSmoothing.pyx":420
6568  * patchBoundaryNodes|=set(femSpace.mesh.elementNodesArray[eN])
6569  * # evaluate the inverse map for element eN (global to local)
6570  * xi = femSpace.elementMaps.getInverseValue(eN, coords) # <<<<<<<<<<<<<<
6571  * #J = femSpace.elementMaps.getJacobianValues(eN, )
6572  * # query whether xi lies within the reference element
6573  */
6574  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_femSpace, __pyx_n_s_elementMaps); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 420, __pyx_L1_error)
6575  __Pyx_GOTREF(__pyx_t_2);
6576  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_getInverseValue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 420, __pyx_L1_error)
6577  __Pyx_GOTREF(__pyx_t_1);
6578  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6579  __pyx_t_2 = NULL;
6580  __pyx_t_9 = 0;
6581  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
6582  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
6583  if (likely(__pyx_t_2)) {
6584  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
6585  __Pyx_INCREF(__pyx_t_2);
6586  __Pyx_INCREF(function);
6587  __Pyx_DECREF_SET(__pyx_t_1, function);
6588  __pyx_t_9 = 1;
6589  }
6590  }
6591  #if CYTHON_FAST_PYCALL
6592  if (PyFunction_Check(__pyx_t_1)) {
6593  PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_eN, __pyx_v_coords};
6594  __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 420, __pyx_L1_error)
6595  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6596  __Pyx_GOTREF(__pyx_t_6);
6597  } else
6598  #endif
6599  #if CYTHON_FAST_PYCCALL
6600  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
6601  PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_eN, __pyx_v_coords};
6602  __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 420, __pyx_L1_error)
6603  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6604  __Pyx_GOTREF(__pyx_t_6);
6605  } else
6606  #endif
6607  {
6608  __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 420, __pyx_L1_error)
6609  __Pyx_GOTREF(__pyx_t_10);
6610  if (__pyx_t_2) {
6611  __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); __pyx_t_2 = NULL;
6612  }
6613  __Pyx_INCREF(__pyx_v_eN);
6614  __Pyx_GIVEREF(__pyx_v_eN);
6615  PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_v_eN);
6616  __Pyx_INCREF(__pyx_v_coords);
6617  __Pyx_GIVEREF(__pyx_v_coords);
6618  PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_v_coords);
6619  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 420, __pyx_L1_error)
6620  __Pyx_GOTREF(__pyx_t_6);
6621  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6622  }
6623  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6624  __Pyx_XDECREF_SET(__pyx_v_xi, __pyx_t_6);
6625  __pyx_t_6 = 0;
6626 
6627  /* "mprans/MeshSmoothing.pyx":423
6628  * #J = femSpace.elementMaps.getJacobianValues(eN, )
6629  * # query whether xi lies within the reference element
6630  * if femSpace.elementMaps.referenceElement.onElement(xi): # <<<<<<<<<<<<<<
6631  * return eN
6632  * else:
6633  */
6634  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_femSpace, __pyx_n_s_elementMaps); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 423, __pyx_L1_error)
6635  __Pyx_GOTREF(__pyx_t_1);
6636  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_referenceElement); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 423, __pyx_L1_error)
6637  __Pyx_GOTREF(__pyx_t_10);
6638  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6639  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_onElement); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 423, __pyx_L1_error)
6640  __Pyx_GOTREF(__pyx_t_1);
6641  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6642  __pyx_t_10 = NULL;
6643  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
6644  __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_1);
6645  if (likely(__pyx_t_10)) {
6646  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
6647  __Pyx_INCREF(__pyx_t_10);
6648  __Pyx_INCREF(function);
6649  __Pyx_DECREF_SET(__pyx_t_1, function);
6650  }
6651  }
6652  __pyx_t_6 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_10, __pyx_v_xi) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_xi);
6653  __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
6654  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 423, __pyx_L1_error)
6655  __Pyx_GOTREF(__pyx_t_6);
6656  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6657  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 423, __pyx_L1_error)
6658  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6659  if (__pyx_t_5) {
6660 
6661  /* "mprans/MeshSmoothing.pyx":424
6662  * # query whether xi lies within the reference element
6663  * if femSpace.elementMaps.referenceElement.onElement(xi):
6664  * return eN # <<<<<<<<<<<<<<
6665  * else:
6666  * for eOffset in range(femSpace.mesh.nodeElementOffsets[node]):
6667  */
6668  __Pyx_XDECREF(__pyx_r);
6669  __Pyx_INCREF(__pyx_v_eN);
6670  __pyx_r = __pyx_v_eN;
6671  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6672  goto __pyx_L0;
6673 
6674  /* "mprans/MeshSmoothing.pyx":423
6675  * #J = femSpace.elementMaps.getJacobianValues(eN, )
6676  * # query whether xi lies within the reference element
6677  * if femSpace.elementMaps.referenceElement.onElement(xi): # <<<<<<<<<<<<<<
6678  * return eN
6679  * else:
6680  */
6681  }
6682 
6683  /* "mprans/MeshSmoothing.pyx":414
6684  * #log Profiling.logEvent("Getting Local Element")
6685  * if node+1 < len(femSpace.mesh.nodeElementOffsets):
6686  * for eOffset in range(femSpace.mesh.nodeElementOffsets[node], femSpace.mesh.nodeElementOffsets[node + 1]): # <<<<<<<<<<<<<<
6687  * eN = femSpace.mesh.nodeElementsArray[eOffset]
6688  * checkedElements.append(eN)
6689  */
6690  }
6691  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6692 
6693  /* "mprans/MeshSmoothing.pyx":413
6694  * # nodeElementOffsets give the indices to get the elements sharing the node
6695  * #log Profiling.logEvent("Getting Local Element")
6696  * if node+1 < len(femSpace.mesh.nodeElementOffsets): # <<<<<<<<<<<<<<
6697  * for eOffset in range(femSpace.mesh.nodeElementOffsets[node], femSpace.mesh.nodeElementOffsets[node + 1]):
6698  * eN = femSpace.mesh.nodeElementsArray[eOffset]
6699  */
6700  goto __pyx_L3;
6701  }
6702 
6703  /* "mprans/MeshSmoothing.pyx":426
6704  * return eN
6705  * else:
6706  * for eOffset in range(femSpace.mesh.nodeElementOffsets[node]): # <<<<<<<<<<<<<<
6707  * eN = femSpace.mesh.nodeElementsArray[eOffset]
6708  * checkedElements.append(eN)
6709  */
6710  /*else*/ {
6711  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_femSpace, __pyx_n_s_mesh); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 426, __pyx_L1_error)
6712  __Pyx_GOTREF(__pyx_t_3);
6713  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_nodeElementOffsets); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 426, __pyx_L1_error)
6714  __Pyx_GOTREF(__pyx_t_6);
6715  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6716  __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_6, __pyx_v_node); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 426, __pyx_L1_error)
6717  __Pyx_GOTREF(__pyx_t_3);
6718  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6719  __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 426, __pyx_L1_error)
6720  __Pyx_GOTREF(__pyx_t_6);
6721  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6722  if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) {
6723  __pyx_t_3 = __pyx_t_6; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
6724  __pyx_t_7 = NULL;
6725  } else {
6726  __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 426, __pyx_L1_error)
6727  __Pyx_GOTREF(__pyx_t_3);
6728  __pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 426, __pyx_L1_error)
6729  }
6730  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6731  for (;;) {
6732  if (likely(!__pyx_t_7)) {
6733  if (likely(PyList_CheckExact(__pyx_t_3))) {
6734  if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
6735  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6736  __pyx_t_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 426, __pyx_L1_error)
6737  #else
6738  __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 426, __pyx_L1_error)
6739  __Pyx_GOTREF(__pyx_t_6);
6740  #endif
6741  } else {
6742  if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
6743  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6744  __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 426, __pyx_L1_error)
6745  #else
6746  __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 426, __pyx_L1_error)
6747  __Pyx_GOTREF(__pyx_t_6);
6748  #endif
6749  }
6750  } else {
6751  __pyx_t_6 = __pyx_t_7(__pyx_t_3);
6752  if (unlikely(!__pyx_t_6)) {
6753  PyObject* exc_type = PyErr_Occurred();
6754  if (exc_type) {
6755  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
6756  else __PYX_ERR(0, 426, __pyx_L1_error)
6757  }
6758  break;
6759  }
6760  __Pyx_GOTREF(__pyx_t_6);
6761  }
6762  __Pyx_XDECREF_SET(__pyx_v_eOffset, __pyx_t_6);
6763  __pyx_t_6 = 0;
6764 
6765  /* "mprans/MeshSmoothing.pyx":427
6766  * else:
6767  * for eOffset in range(femSpace.mesh.nodeElementOffsets[node]):
6768  * eN = femSpace.mesh.nodeElementsArray[eOffset] # <<<<<<<<<<<<<<
6769  * checkedElements.append(eN)
6770  * # union of set
6771  */
6772  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_femSpace, __pyx_n_s_mesh); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 427, __pyx_L1_error)
6773  __Pyx_GOTREF(__pyx_t_6);
6774  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_nodeElementsArray); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 427, __pyx_L1_error)
6775  __Pyx_GOTREF(__pyx_t_1);
6776  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6777  __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_eOffset); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 427, __pyx_L1_error)
6778  __Pyx_GOTREF(__pyx_t_6);
6779  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6780  __Pyx_XDECREF_SET(__pyx_v_eN, __pyx_t_6);
6781  __pyx_t_6 = 0;
6782 
6783  /* "mprans/MeshSmoothing.pyx":428
6784  * for eOffset in range(femSpace.mesh.nodeElementOffsets[node]):
6785  * eN = femSpace.mesh.nodeElementsArray[eOffset]
6786  * checkedElements.append(eN) # <<<<<<<<<<<<<<
6787  * # union of set
6788  * patchBoundaryNodes|=set(femSpace.mesh.elementNodesArray[eN])
6789  */
6790  __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_checkedElements, __pyx_v_eN); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 428, __pyx_L1_error)
6791 
6792  /* "mprans/MeshSmoothing.pyx":430
6793  * checkedElements.append(eN)
6794  * # union of set
6795  * patchBoundaryNodes|=set(femSpace.mesh.elementNodesArray[eN]) # <<<<<<<<<<<<<<
6796  * # evaluate the inverse map for element eN (global to local)
6797  * xi = femSpace.elementMaps.getInverseValue(eN, coords)
6798  */
6799  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_femSpace, __pyx_n_s_mesh); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 430, __pyx_L1_error)
6800  __Pyx_GOTREF(__pyx_t_6);
6801  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_elementNodesArray); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 430, __pyx_L1_error)
6802  __Pyx_GOTREF(__pyx_t_1);
6803  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6804  __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_eN); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 430, __pyx_L1_error)
6805  __Pyx_GOTREF(__pyx_t_6);
6806  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6807  __pyx_t_1 = PySet_New(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 430, __pyx_L1_error)
6808  __Pyx_GOTREF(__pyx_t_1);
6809  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6810  __pyx_t_6 = PyNumber_InPlaceOr(__pyx_v_patchBoundaryNodes, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 430, __pyx_L1_error)
6811  __Pyx_GOTREF(__pyx_t_6);
6812  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6813  __Pyx_DECREF_SET(__pyx_v_patchBoundaryNodes, ((PyObject*)__pyx_t_6));
6814  __pyx_t_6 = 0;
6815 
6816  /* "mprans/MeshSmoothing.pyx":432
6817  * patchBoundaryNodes|=set(femSpace.mesh.elementNodesArray[eN])
6818  * # evaluate the inverse map for element eN (global to local)
6819  * xi = femSpace.elementMaps.getInverseValue(eN, coords) # <<<<<<<<<<<<<<
6820  * #J = femSpace.elementMaps.getJacobianValues(eN, )
6821  * # query whether xi lies within the reference element
6822  */
6823  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_femSpace, __pyx_n_s_elementMaps); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 432, __pyx_L1_error)
6824  __Pyx_GOTREF(__pyx_t_1);
6825  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_getInverseValue); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 432, __pyx_L1_error)
6826  __Pyx_GOTREF(__pyx_t_10);
6827  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6828  __pyx_t_1 = NULL;
6829  __pyx_t_9 = 0;
6830  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
6831  __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_10);
6832  if (likely(__pyx_t_1)) {
6833  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
6834  __Pyx_INCREF(__pyx_t_1);
6835  __Pyx_INCREF(function);
6836  __Pyx_DECREF_SET(__pyx_t_10, function);
6837  __pyx_t_9 = 1;
6838  }
6839  }
6840  #if CYTHON_FAST_PYCALL
6841  if (PyFunction_Check(__pyx_t_10)) {
6842  PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_eN, __pyx_v_coords};
6843  __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 432, __pyx_L1_error)
6844  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
6845  __Pyx_GOTREF(__pyx_t_6);
6846  } else
6847  #endif
6848  #if CYTHON_FAST_PYCCALL
6849  if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
6850  PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_eN, __pyx_v_coords};
6851  __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 432, __pyx_L1_error)
6852  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
6853  __Pyx_GOTREF(__pyx_t_6);
6854  } else
6855  #endif
6856  {
6857  __pyx_t_2 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 432, __pyx_L1_error)
6858  __Pyx_GOTREF(__pyx_t_2);
6859  if (__pyx_t_1) {
6860  __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = NULL;
6861  }
6862  __Pyx_INCREF(__pyx_v_eN);
6863  __Pyx_GIVEREF(__pyx_v_eN);
6864  PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_9, __pyx_v_eN);
6865  __Pyx_INCREF(__pyx_v_coords);
6866  __Pyx_GIVEREF(__pyx_v_coords);
6867  PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_9, __pyx_v_coords);
6868  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_2, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 432, __pyx_L1_error)
6869  __Pyx_GOTREF(__pyx_t_6);
6870  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6871  }
6872  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6873  __Pyx_XDECREF_SET(__pyx_v_xi, __pyx_t_6);
6874  __pyx_t_6 = 0;
6875 
6876  /* "mprans/MeshSmoothing.pyx":435
6877  * #J = femSpace.elementMaps.getJacobianValues(eN, )
6878  * # query whether xi lies within the reference element
6879  * if femSpace.elementMaps.referenceElement.onElement(xi): # <<<<<<<<<<<<<<
6880  * return eN
6881  * # extra loop if case coords is in neighbour element
6882  */
6883  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_femSpace, __pyx_n_s_elementMaps); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 435, __pyx_L1_error)
6884  __Pyx_GOTREF(__pyx_t_10);
6885  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_referenceElement); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 435, __pyx_L1_error)
6886  __Pyx_GOTREF(__pyx_t_2);
6887  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6888  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_onElement); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 435, __pyx_L1_error)
6889  __Pyx_GOTREF(__pyx_t_10);
6890  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6891  __pyx_t_2 = NULL;
6892  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
6893  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_10);
6894  if (likely(__pyx_t_2)) {
6895  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
6896  __Pyx_INCREF(__pyx_t_2);
6897  __Pyx_INCREF(function);
6898  __Pyx_DECREF_SET(__pyx_t_10, function);
6899  }
6900  }
6901  __pyx_t_6 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_2, __pyx_v_xi) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_xi);
6902  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6903  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 435, __pyx_L1_error)
6904  __Pyx_GOTREF(__pyx_t_6);
6905  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6906  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 435, __pyx_L1_error)
6907  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6908  if (__pyx_t_5) {
6909 
6910  /* "mprans/MeshSmoothing.pyx":436
6911  * # query whether xi lies within the reference element
6912  * if femSpace.elementMaps.referenceElement.onElement(xi):
6913  * return eN # <<<<<<<<<<<<<<
6914  * # extra loop if case coords is in neighbour element
6915  * for node in patchBoundaryNodes:
6916  */
6917  __Pyx_XDECREF(__pyx_r);
6918  __Pyx_INCREF(__pyx_v_eN);
6919  __pyx_r = __pyx_v_eN;
6920  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6921  goto __pyx_L0;
6922 
6923  /* "mprans/MeshSmoothing.pyx":435
6924  * #J = femSpace.elementMaps.getJacobianValues(eN, )
6925  * # query whether xi lies within the reference element
6926  * if femSpace.elementMaps.referenceElement.onElement(xi): # <<<<<<<<<<<<<<
6927  * return eN
6928  * # extra loop if case coords is in neighbour element
6929  */
6930  }
6931 
6932  /* "mprans/MeshSmoothing.pyx":426
6933  * return eN
6934  * else:
6935  * for eOffset in range(femSpace.mesh.nodeElementOffsets[node]): # <<<<<<<<<<<<<<
6936  * eN = femSpace.mesh.nodeElementsArray[eOffset]
6937  * checkedElements.append(eN)
6938  */
6939  }
6940  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6941  }
6942  __pyx_L3:;
6943 
6944  /* "mprans/MeshSmoothing.pyx":438
6945  * return eN
6946  * # extra loop if case coords is in neighbour element
6947  * for node in patchBoundaryNodes: # <<<<<<<<<<<<<<
6948  * for eOffset in range(femSpace.mesh.nodeElementOffsets[node], femSpace.mesh.nodeElementOffsets[node + 1]):
6949  * eN = femSpace.mesh.nodeElementsArray[eOffset]
6950  */
6951  __pyx_t_4 = 0;
6952  __pyx_t_6 = __Pyx_set_iterator(__pyx_v_patchBoundaryNodes, 1, (&__pyx_t_11), (&__pyx_t_9)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 438, __pyx_L1_error)
6953  __Pyx_GOTREF(__pyx_t_6);
6954  __Pyx_XDECREF(__pyx_t_3);
6955  __pyx_t_3 = __pyx_t_6;
6956  __pyx_t_6 = 0;
6957  while (1) {
6958  __pyx_t_12 = __Pyx_set_iter_next(__pyx_t_3, __pyx_t_11, &__pyx_t_4, &__pyx_t_6, __pyx_t_9);
6959  if (unlikely(__pyx_t_12 == 0)) break;
6960  if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(0, 438, __pyx_L1_error)
6961  __Pyx_GOTREF(__pyx_t_6);
6962  __Pyx_DECREF_SET(__pyx_v_node, __pyx_t_6);
6963  __pyx_t_6 = 0;
6964 
6965  /* "mprans/MeshSmoothing.pyx":439
6966  * # extra loop if case coords is in neighbour element
6967  * for node in patchBoundaryNodes:
6968  * for eOffset in range(femSpace.mesh.nodeElementOffsets[node], femSpace.mesh.nodeElementOffsets[node + 1]): # <<<<<<<<<<<<<<
6969  * eN = femSpace.mesh.nodeElementsArray[eOffset]
6970  * if eN not in checkedElements:
6971  */
6972  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_femSpace, __pyx_n_s_mesh); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 439, __pyx_L1_error)
6973  __Pyx_GOTREF(__pyx_t_6);
6974  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_nodeElementOffsets); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 439, __pyx_L1_error)
6975  __Pyx_GOTREF(__pyx_t_10);
6976  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6977  __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_10, __pyx_v_node); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 439, __pyx_L1_error)
6978  __Pyx_GOTREF(__pyx_t_6);
6979  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6980  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_femSpace, __pyx_n_s_mesh); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 439, __pyx_L1_error)
6981  __Pyx_GOTREF(__pyx_t_10);
6982  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_nodeElementOffsets); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 439, __pyx_L1_error)
6983  __Pyx_GOTREF(__pyx_t_2);
6984  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6985  __pyx_t_10 = __Pyx_PyInt_AddObjC(__pyx_v_node, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 439, __pyx_L1_error)
6986  __Pyx_GOTREF(__pyx_t_10);
6987  __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L1_error)
6988  __Pyx_GOTREF(__pyx_t_1);
6989  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6990  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6991  __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 439, __pyx_L1_error)
6992  __Pyx_GOTREF(__pyx_t_10);
6993  __Pyx_GIVEREF(__pyx_t_6);
6994  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_6);
6995  __Pyx_GIVEREF(__pyx_t_1);
6996  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1);
6997  __pyx_t_6 = 0;
6998  __pyx_t_1 = 0;
6999  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L1_error)
7000  __Pyx_GOTREF(__pyx_t_1);
7001  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7002  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
7003  __pyx_t_10 = __pyx_t_1; __Pyx_INCREF(__pyx_t_10); __pyx_t_13 = 0;
7004  __pyx_t_7 = NULL;
7005  } else {
7006  __pyx_t_13 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 439, __pyx_L1_error)
7007  __Pyx_GOTREF(__pyx_t_10);
7008  __pyx_t_7 = Py_TYPE(__pyx_t_10)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 439, __pyx_L1_error)
7009  }
7010  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7011  for (;;) {
7012  if (likely(!__pyx_t_7)) {
7013  if (likely(PyList_CheckExact(__pyx_t_10))) {
7014  if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_10)) break;
7015  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7016  __pyx_t_1 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 439, __pyx_L1_error)
7017  #else
7018  __pyx_t_1 = PySequence_ITEM(__pyx_t_10, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L1_error)
7019  __Pyx_GOTREF(__pyx_t_1);
7020  #endif
7021  } else {
7022  if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_10)) break;
7023  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7024  __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 439, __pyx_L1_error)
7025  #else
7026  __pyx_t_1 = PySequence_ITEM(__pyx_t_10, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L1_error)
7027  __Pyx_GOTREF(__pyx_t_1);
7028  #endif
7029  }
7030  } else {
7031  __pyx_t_1 = __pyx_t_7(__pyx_t_10);
7032  if (unlikely(!__pyx_t_1)) {
7033  PyObject* exc_type = PyErr_Occurred();
7034  if (exc_type) {
7035  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
7036  else __PYX_ERR(0, 439, __pyx_L1_error)
7037  }
7038  break;
7039  }
7040  __Pyx_GOTREF(__pyx_t_1);
7041  }
7042  __Pyx_XDECREF_SET(__pyx_v_eOffset, __pyx_t_1);
7043  __pyx_t_1 = 0;
7044 
7045  /* "mprans/MeshSmoothing.pyx":440
7046  * for node in patchBoundaryNodes:
7047  * for eOffset in range(femSpace.mesh.nodeElementOffsets[node], femSpace.mesh.nodeElementOffsets[node + 1]):
7048  * eN = femSpace.mesh.nodeElementsArray[eOffset] # <<<<<<<<<<<<<<
7049  * if eN not in checkedElements:
7050  * checkedElements.append(eN)
7051  */
7052  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_femSpace, __pyx_n_s_mesh); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 440, __pyx_L1_error)
7053  __Pyx_GOTREF(__pyx_t_1);
7054  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_nodeElementsArray); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 440, __pyx_L1_error)
7055  __Pyx_GOTREF(__pyx_t_6);
7056  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7057  __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_6, __pyx_v_eOffset); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 440, __pyx_L1_error)
7058  __Pyx_GOTREF(__pyx_t_1);
7059  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7060  __Pyx_XDECREF_SET(__pyx_v_eN, __pyx_t_1);
7061  __pyx_t_1 = 0;
7062 
7063  /* "mprans/MeshSmoothing.pyx":441
7064  * for eOffset in range(femSpace.mesh.nodeElementOffsets[node], femSpace.mesh.nodeElementOffsets[node + 1]):
7065  * eN = femSpace.mesh.nodeElementsArray[eOffset]
7066  * if eN not in checkedElements: # <<<<<<<<<<<<<<
7067  * checkedElements.append(eN)
7068  * # evaluate the inverse map for element eN
7069  */
7070  __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_v_eN, __pyx_v_checkedElements, Py_NE)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 441, __pyx_L1_error)
7071  __pyx_t_14 = (__pyx_t_5 != 0);
7072  if (__pyx_t_14) {
7073 
7074  /* "mprans/MeshSmoothing.pyx":442
7075  * eN = femSpace.mesh.nodeElementsArray[eOffset]
7076  * if eN not in checkedElements:
7077  * checkedElements.append(eN) # <<<<<<<<<<<<<<
7078  * # evaluate the inverse map for element eN
7079  * xi = femSpace.elementMaps.getInverseValue(eN, coords)
7080  */
7081  __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_checkedElements, __pyx_v_eN); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 442, __pyx_L1_error)
7082 
7083  /* "mprans/MeshSmoothing.pyx":444
7084  * checkedElements.append(eN)
7085  * # evaluate the inverse map for element eN
7086  * xi = femSpace.elementMaps.getInverseValue(eN, coords) # <<<<<<<<<<<<<<
7087  * # query whether xi lies within the reference element
7088  * if femSpace.elementMaps.referenceElement.onElement(xi):
7089  */
7090  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_femSpace, __pyx_n_s_elementMaps); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 444, __pyx_L1_error)
7091  __Pyx_GOTREF(__pyx_t_6);
7092  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_getInverseValue); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 444, __pyx_L1_error)
7093  __Pyx_GOTREF(__pyx_t_2);
7094  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7095  __pyx_t_6 = NULL;
7096  __pyx_t_12 = 0;
7097  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
7098  __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
7099  if (likely(__pyx_t_6)) {
7100  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
7101  __Pyx_INCREF(__pyx_t_6);
7102  __Pyx_INCREF(function);
7103  __Pyx_DECREF_SET(__pyx_t_2, function);
7104  __pyx_t_12 = 1;
7105  }
7106  }
7107  #if CYTHON_FAST_PYCALL
7108  if (PyFunction_Check(__pyx_t_2)) {
7109  PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_eN, __pyx_v_coords};
7110  __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 444, __pyx_L1_error)
7111  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7112  __Pyx_GOTREF(__pyx_t_1);
7113  } else
7114  #endif
7115  #if CYTHON_FAST_PYCCALL
7116  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
7117  PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_eN, __pyx_v_coords};
7118  __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 444, __pyx_L1_error)
7119  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7120  __Pyx_GOTREF(__pyx_t_1);
7121  } else
7122  #endif
7123  {
7124  __pyx_t_15 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 444, __pyx_L1_error)
7125  __Pyx_GOTREF(__pyx_t_15);
7126  if (__pyx_t_6) {
7127  __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_6); __pyx_t_6 = NULL;
7128  }
7129  __Pyx_INCREF(__pyx_v_eN);
7130  __Pyx_GIVEREF(__pyx_v_eN);
7131  PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_12, __pyx_v_eN);
7132  __Pyx_INCREF(__pyx_v_coords);
7133  __Pyx_GIVEREF(__pyx_v_coords);
7134  PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_12, __pyx_v_coords);
7135  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 444, __pyx_L1_error)
7136  __Pyx_GOTREF(__pyx_t_1);
7137  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7138  }
7139  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7140  __Pyx_XDECREF_SET(__pyx_v_xi, __pyx_t_1);
7141  __pyx_t_1 = 0;
7142 
7143  /* "mprans/MeshSmoothing.pyx":446
7144  * xi = femSpace.elementMaps.getInverseValue(eN, coords)
7145  * # query whether xi lies within the reference element
7146  * if femSpace.elementMaps.referenceElement.onElement(xi): # <<<<<<<<<<<<<<
7147  * return eN
7148  * # no elements found
7149  */
7150  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_femSpace, __pyx_n_s_elementMaps); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 446, __pyx_L1_error)
7151  __Pyx_GOTREF(__pyx_t_2);
7152  __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_referenceElement); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 446, __pyx_L1_error)
7153  __Pyx_GOTREF(__pyx_t_15);
7154  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7155  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_onElement); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 446, __pyx_L1_error)
7156  __Pyx_GOTREF(__pyx_t_2);
7157  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7158  __pyx_t_15 = NULL;
7159  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
7160  __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_2);
7161  if (likely(__pyx_t_15)) {
7162  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
7163  __Pyx_INCREF(__pyx_t_15);
7164  __Pyx_INCREF(function);
7165  __Pyx_DECREF_SET(__pyx_t_2, function);
7166  }
7167  }
7168  __pyx_t_1 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_15, __pyx_v_xi) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_xi);
7169  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
7170  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 446, __pyx_L1_error)
7171  __Pyx_GOTREF(__pyx_t_1);
7172  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7173  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 446, __pyx_L1_error)
7174  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7175  if (__pyx_t_14) {
7176 
7177  /* "mprans/MeshSmoothing.pyx":447
7178  * # query whether xi lies within the reference element
7179  * if femSpace.elementMaps.referenceElement.onElement(xi):
7180  * return eN # <<<<<<<<<<<<<<
7181  * # no elements found
7182  * return None
7183  */
7184  __Pyx_XDECREF(__pyx_r);
7185  __Pyx_INCREF(__pyx_v_eN);
7186  __pyx_r = __pyx_v_eN;
7187  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7188  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7189  goto __pyx_L0;
7190 
7191  /* "mprans/MeshSmoothing.pyx":446
7192  * xi = femSpace.elementMaps.getInverseValue(eN, coords)
7193  * # query whether xi lies within the reference element
7194  * if femSpace.elementMaps.referenceElement.onElement(xi): # <<<<<<<<<<<<<<
7195  * return eN
7196  * # no elements found
7197  */
7198  }
7199 
7200  /* "mprans/MeshSmoothing.pyx":441
7201  * for eOffset in range(femSpace.mesh.nodeElementOffsets[node], femSpace.mesh.nodeElementOffsets[node + 1]):
7202  * eN = femSpace.mesh.nodeElementsArray[eOffset]
7203  * if eN not in checkedElements: # <<<<<<<<<<<<<<
7204  * checkedElements.append(eN)
7205  * # evaluate the inverse map for element eN
7206  */
7207  }
7208 
7209  /* "mprans/MeshSmoothing.pyx":439
7210  * # extra loop if case coords is in neighbour element
7211  * for node in patchBoundaryNodes:
7212  * for eOffset in range(femSpace.mesh.nodeElementOffsets[node], femSpace.mesh.nodeElementOffsets[node + 1]): # <<<<<<<<<<<<<<
7213  * eN = femSpace.mesh.nodeElementsArray[eOffset]
7214  * if eN not in checkedElements:
7215  */
7216  }
7217  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7218  }
7219  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7220 
7221  /* "mprans/MeshSmoothing.pyx":449
7222  * return eN
7223  * # no elements found
7224  * return None # <<<<<<<<<<<<<<
7225  *
7226  *
7227  */
7228  __Pyx_XDECREF(__pyx_r);
7229  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7230  goto __pyx_L0;
7231 
7232  /* "mprans/MeshSmoothing.pyx":388
7233  * eN=eN)
7234  *
7235  * def getLocalElement(femSpace, # <<<<<<<<<<<<<<
7236  * coords,
7237  * node):
7238  */
7239 
7240  /* function exit code */
7241  __pyx_L1_error:;
7242  __Pyx_XDECREF(__pyx_t_1);
7243  __Pyx_XDECREF(__pyx_t_2);
7244  __Pyx_XDECREF(__pyx_t_3);
7245  __Pyx_XDECREF(__pyx_t_6);
7246  __Pyx_XDECREF(__pyx_t_10);
7247  __Pyx_XDECREF(__pyx_t_15);
7248  __Pyx_AddTraceback("mprans.MeshSmoothing.getLocalElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
7249  __pyx_r = NULL;
7250  __pyx_L0:;
7251  __Pyx_XDECREF(__pyx_v_patchBoundaryNodes);
7252  __Pyx_XDECREF(__pyx_v_checkedElements);
7253  __Pyx_XDECREF(__pyx_v_eOffset);
7254  __Pyx_XDECREF(__pyx_v_eN);
7255  __Pyx_XDECREF(__pyx_v_xi);
7256  __Pyx_XDECREF(__pyx_v_node);
7257  __Pyx_XGIVEREF(__pyx_r);
7258  __Pyx_RefNannyFinishContext();
7259  return __pyx_r;
7260 }
7261 
7262 /* "mprans/MeshSmoothing.pyx":452
7263  *
7264  *
7265  * def updateElementBoundaryNormalsTriangle(double[:,:,:] elementBoundaryNormalsArray_, # <<<<<<<<<<<<<<
7266  * double[:,:] nodeArray,
7267  * int[:,:] elementBoundariesArray,
7268  */
7269 
7270 /* Python wrapper */
7271 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_35updateElementBoundaryNormalsTriangle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7272 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_35updateElementBoundaryNormalsTriangle = {"updateElementBoundaryNormalsTriangle", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_35updateElementBoundaryNormalsTriangle, METH_VARARGS|METH_KEYWORDS, 0};
7273 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_35updateElementBoundaryNormalsTriangle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7274  __Pyx_memviewslice __pyx_v_elementBoundaryNormalsArray_ = { 0, 0, { 0 }, { 0 }, { 0 } };
7275  __Pyx_memviewslice __pyx_v_nodeArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7276  __Pyx_memviewslice __pyx_v_elementBoundariesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7277  __Pyx_memviewslice __pyx_v_elementBoundaryNodesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7278  __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7279  __Pyx_memviewslice __pyx_v_elementBarycentersArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7280  int __pyx_v_nElements;
7281  PyObject *__pyx_r = 0;
7282  __Pyx_RefNannyDeclarations
7283  __Pyx_RefNannySetupContext("updateElementBoundaryNormalsTriangle (wrapper)", 0);
7284  {
7285  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementBoundaryNormalsArray_2,&__pyx_n_s_nodeArray_2,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryNodesArray,&__pyx_n_s_elementBoundaryBarycentersArray,&__pyx_n_s_elementBarycentersArray,&__pyx_n_s_nElements,0};
7286  PyObject* values[7] = {0,0,0,0,0,0,0};
7287  if (unlikely(__pyx_kwds)) {
7288  Py_ssize_t kw_args;
7289  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7290  switch (pos_args) {
7291  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
7292  CYTHON_FALLTHROUGH;
7293  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
7294  CYTHON_FALLTHROUGH;
7295  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7296  CYTHON_FALLTHROUGH;
7297  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7298  CYTHON_FALLTHROUGH;
7299  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7300  CYTHON_FALLTHROUGH;
7301  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7302  CYTHON_FALLTHROUGH;
7303  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7304  CYTHON_FALLTHROUGH;
7305  case 0: break;
7306  default: goto __pyx_L5_argtuple_error;
7307  }
7308  kw_args = PyDict_Size(__pyx_kwds);
7309  switch (pos_args) {
7310  case 0:
7311  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryNormalsArray_2)) != 0)) kw_args--;
7312  else goto __pyx_L5_argtuple_error;
7313  CYTHON_FALLTHROUGH;
7314  case 1:
7315  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeArray_2)) != 0)) kw_args--;
7316  else {
7317  __Pyx_RaiseArgtupleInvalid("updateElementBoundaryNormalsTriangle", 1, 7, 7, 1); __PYX_ERR(0, 452, __pyx_L3_error)
7318  }
7319  CYTHON_FALLTHROUGH;
7320  case 2:
7321  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
7322  else {
7323  __Pyx_RaiseArgtupleInvalid("updateElementBoundaryNormalsTriangle", 1, 7, 7, 2); __PYX_ERR(0, 452, __pyx_L3_error)
7324  }
7325  CYTHON_FALLTHROUGH;
7326  case 3:
7327  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryNodesArray)) != 0)) kw_args--;
7328  else {
7329  __Pyx_RaiseArgtupleInvalid("updateElementBoundaryNormalsTriangle", 1, 7, 7, 3); __PYX_ERR(0, 452, __pyx_L3_error)
7330  }
7331  CYTHON_FALLTHROUGH;
7332  case 4:
7333  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryBarycentersArray)) != 0)) kw_args--;
7334  else {
7335  __Pyx_RaiseArgtupleInvalid("updateElementBoundaryNormalsTriangle", 1, 7, 7, 4); __PYX_ERR(0, 452, __pyx_L3_error)
7336  }
7337  CYTHON_FALLTHROUGH;
7338  case 5:
7339  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
7340  else {
7341  __Pyx_RaiseArgtupleInvalid("updateElementBoundaryNormalsTriangle", 1, 7, 7, 5); __PYX_ERR(0, 452, __pyx_L3_error)
7342  }
7343  CYTHON_FALLTHROUGH;
7344  case 6:
7345  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements)) != 0)) kw_args--;
7346  else {
7347  __Pyx_RaiseArgtupleInvalid("updateElementBoundaryNormalsTriangle", 1, 7, 7, 6); __PYX_ERR(0, 452, __pyx_L3_error)
7348  }
7349  }
7350  if (unlikely(kw_args > 0)) {
7351  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "updateElementBoundaryNormalsTriangle") < 0)) __PYX_ERR(0, 452, __pyx_L3_error)
7352  }
7353  } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
7354  goto __pyx_L5_argtuple_error;
7355  } else {
7356  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7357  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7358  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7359  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7360  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7361  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
7362  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
7363  }
7364  __pyx_v_elementBoundaryNormalsArray_ = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundaryNormalsArray_.memview)) __PYX_ERR(0, 452, __pyx_L3_error)
7365  __pyx_v_nodeArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeArray.memview)) __PYX_ERR(0, 453, __pyx_L3_error)
7366  __pyx_v_elementBoundariesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundariesArray.memview)) __PYX_ERR(0, 454, __pyx_L3_error)
7367  __pyx_v_elementBoundaryNodesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundaryNodesArray.memview)) __PYX_ERR(0, 455, __pyx_L3_error)
7368  __pyx_v_elementBoundaryBarycentersArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundaryBarycentersArray.memview)) __PYX_ERR(0, 456, __pyx_L3_error)
7369  __pyx_v_elementBarycentersArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBarycentersArray.memview)) __PYX_ERR(0, 457, __pyx_L3_error)
7370  __pyx_v_nElements = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_nElements == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 458, __pyx_L3_error)
7371  }
7372  goto __pyx_L4_argument_unpacking_done;
7373  __pyx_L5_argtuple_error:;
7374  __Pyx_RaiseArgtupleInvalid("updateElementBoundaryNormalsTriangle", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 452, __pyx_L3_error)
7375  __pyx_L3_error:;
7376  __Pyx_AddTraceback("mprans.MeshSmoothing.updateElementBoundaryNormalsTriangle", __pyx_clineno, __pyx_lineno, __pyx_filename);
7377  __Pyx_RefNannyFinishContext();
7378  return NULL;
7379  __pyx_L4_argument_unpacking_done:;
7380  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_34updateElementBoundaryNormalsTriangle(__pyx_self, __pyx_v_elementBoundaryNormalsArray_, __pyx_v_nodeArray, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryNodesArray, __pyx_v_elementBoundaryBarycentersArray, __pyx_v_elementBarycentersArray, __pyx_v_nElements);
7381 
7382  /* function exit code */
7383  __Pyx_RefNannyFinishContext();
7384  return __pyx_r;
7385 }
7386 
7387 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_34updateElementBoundaryNormalsTriangle(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_elementBoundaryNormalsArray_, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementBoundariesArray, __Pyx_memviewslice __pyx_v_elementBoundaryNodesArray, __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray, __Pyx_memviewslice __pyx_v_elementBarycentersArray, int __pyx_v_nElements) {
7388  PyObject *__pyx_r = NULL;
7389  __Pyx_RefNannyDeclarations
7390  __Pyx_RefNannySetupContext("updateElementBoundaryNormalsTriangle", 0);
7391 
7392  /* "mprans/MeshSmoothing.pyx":459
7393  * double[:,:] elementBarycentersArray,
7394  * int nElements):
7395  * pyxUpdateElementBoundaryNormalsTriangle(elementBoundaryNormalsArray_=elementBoundaryNormalsArray_, # <<<<<<<<<<<<<<
7396  * nodeArray=nodeArray,
7397  * elementBoundariesArray=elementBoundariesArray,
7398  */
7399  __pyx_f_6mprans_13MeshSmoothing_pyxUpdateElementBoundaryNormalsTriangle(__pyx_v_elementBoundaryNormalsArray_, __pyx_v_nodeArray, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryNodesArray, __pyx_v_elementBoundaryBarycentersArray, __pyx_v_elementBarycentersArray, __pyx_v_nElements);
7400 
7401  /* "mprans/MeshSmoothing.pyx":452
7402  *
7403  *
7404  * def updateElementBoundaryNormalsTriangle(double[:,:,:] elementBoundaryNormalsArray_, # <<<<<<<<<<<<<<
7405  * double[:,:] nodeArray,
7406  * int[:,:] elementBoundariesArray,
7407  */
7408 
7409  /* function exit code */
7410  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7411  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundaryNormalsArray_, 1);
7412  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray, 1);
7413  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundariesArray, 1);
7414  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundaryNodesArray, 1);
7415  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundaryBarycentersArray, 1);
7416  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBarycentersArray, 1);
7417  __Pyx_XGIVEREF(__pyx_r);
7418  __Pyx_RefNannyFinishContext();
7419  return __pyx_r;
7420 }
7421 
7422 /* "mprans/MeshSmoothing.pyx":467
7423  * nElements=nElements)
7424  *
7425  * def getElementBoundaryNormalsTriangle(double[:,:] nodeArray, # <<<<<<<<<<<<<<
7426  * int[:,:] elementBoundariesArray,
7427  * int[:,:] elementBoundaryNodesArray,
7428  */
7429 
7430 /* Python wrapper */
7431 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_37getElementBoundaryNormalsTriangle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7432 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_37getElementBoundaryNormalsTriangle = {"getElementBoundaryNormalsTriangle", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_37getElementBoundaryNormalsTriangle, METH_VARARGS|METH_KEYWORDS, 0};
7433 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_37getElementBoundaryNormalsTriangle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7434  __Pyx_memviewslice __pyx_v_nodeArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7435  __Pyx_memviewslice __pyx_v_elementBoundariesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7436  __Pyx_memviewslice __pyx_v_elementBoundaryNodesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7437  __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7438  __Pyx_memviewslice __pyx_v_elementBarycentersArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7439  PyObject *__pyx_r = 0;
7440  __Pyx_RefNannyDeclarations
7441  __Pyx_RefNannySetupContext("getElementBoundaryNormalsTriangle (wrapper)", 0);
7442  {
7443  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nodeArray_2,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryNodesArray,&__pyx_n_s_elementBoundaryBarycentersArray,&__pyx_n_s_elementBarycentersArray,0};
7444  PyObject* values[5] = {0,0,0,0,0};
7445  if (unlikely(__pyx_kwds)) {
7446  Py_ssize_t kw_args;
7447  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7448  switch (pos_args) {
7449  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7450  CYTHON_FALLTHROUGH;
7451  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7452  CYTHON_FALLTHROUGH;
7453  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7454  CYTHON_FALLTHROUGH;
7455  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7456  CYTHON_FALLTHROUGH;
7457  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7458  CYTHON_FALLTHROUGH;
7459  case 0: break;
7460  default: goto __pyx_L5_argtuple_error;
7461  }
7462  kw_args = PyDict_Size(__pyx_kwds);
7463  switch (pos_args) {
7464  case 0:
7465  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeArray_2)) != 0)) kw_args--;
7466  else goto __pyx_L5_argtuple_error;
7467  CYTHON_FALLTHROUGH;
7468  case 1:
7469  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
7470  else {
7471  __Pyx_RaiseArgtupleInvalid("getElementBoundaryNormalsTriangle", 1, 5, 5, 1); __PYX_ERR(0, 467, __pyx_L3_error)
7472  }
7473  CYTHON_FALLTHROUGH;
7474  case 2:
7475  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryNodesArray)) != 0)) kw_args--;
7476  else {
7477  __Pyx_RaiseArgtupleInvalid("getElementBoundaryNormalsTriangle", 1, 5, 5, 2); __PYX_ERR(0, 467, __pyx_L3_error)
7478  }
7479  CYTHON_FALLTHROUGH;
7480  case 3:
7481  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryBarycentersArray)) != 0)) kw_args--;
7482  else {
7483  __Pyx_RaiseArgtupleInvalid("getElementBoundaryNormalsTriangle", 1, 5, 5, 3); __PYX_ERR(0, 467, __pyx_L3_error)
7484  }
7485  CYTHON_FALLTHROUGH;
7486  case 4:
7487  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
7488  else {
7489  __Pyx_RaiseArgtupleInvalid("getElementBoundaryNormalsTriangle", 1, 5, 5, 4); __PYX_ERR(0, 467, __pyx_L3_error)
7490  }
7491  }
7492  if (unlikely(kw_args > 0)) {
7493  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getElementBoundaryNormalsTriangle") < 0)) __PYX_ERR(0, 467, __pyx_L3_error)
7494  }
7495  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
7496  goto __pyx_L5_argtuple_error;
7497  } else {
7498  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7499  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7500  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7501  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7502  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7503  }
7504  __pyx_v_nodeArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeArray.memview)) __PYX_ERR(0, 467, __pyx_L3_error)
7505  __pyx_v_elementBoundariesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundariesArray.memview)) __PYX_ERR(0, 468, __pyx_L3_error)
7506  __pyx_v_elementBoundaryNodesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundaryNodesArray.memview)) __PYX_ERR(0, 469, __pyx_L3_error)
7507  __pyx_v_elementBoundaryBarycentersArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundaryBarycentersArray.memview)) __PYX_ERR(0, 470, __pyx_L3_error)
7508  __pyx_v_elementBarycentersArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBarycentersArray.memview)) __PYX_ERR(0, 471, __pyx_L3_error)
7509  }
7510  goto __pyx_L4_argument_unpacking_done;
7511  __pyx_L5_argtuple_error:;
7512  __Pyx_RaiseArgtupleInvalid("getElementBoundaryNormalsTriangle", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 467, __pyx_L3_error)
7513  __pyx_L3_error:;
7514  __Pyx_AddTraceback("mprans.MeshSmoothing.getElementBoundaryNormalsTriangle", __pyx_clineno, __pyx_lineno, __pyx_filename);
7515  __Pyx_RefNannyFinishContext();
7516  return NULL;
7517  __pyx_L4_argument_unpacking_done:;
7518  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_36getElementBoundaryNormalsTriangle(__pyx_self, __pyx_v_nodeArray, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryNodesArray, __pyx_v_elementBoundaryBarycentersArray, __pyx_v_elementBarycentersArray);
7519 
7520  /* function exit code */
7521  __Pyx_RefNannyFinishContext();
7522  return __pyx_r;
7523 }
7524 
7525 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_36getElementBoundaryNormalsTriangle(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementBoundariesArray, __Pyx_memviewslice __pyx_v_elementBoundaryNodesArray, __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray, __Pyx_memviewslice __pyx_v_elementBarycentersArray) {
7526  PyObject *__pyx_v_elementBoundaryNormalsArray_ = NULL;
7527  int __pyx_v_nElements;
7528  PyObject *__pyx_r = NULL;
7529  __Pyx_RefNannyDeclarations
7530  PyObject *__pyx_t_1 = NULL;
7531  PyObject *__pyx_t_2 = NULL;
7532  PyObject *__pyx_t_3 = NULL;
7533  PyObject *__pyx_t_4 = NULL;
7534  int __pyx_t_5;
7535  PyObject *__pyx_t_6 = NULL;
7536  Py_ssize_t __pyx_t_7;
7537  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
7538  __Pyx_RefNannySetupContext("getElementBoundaryNormalsTriangle", 0);
7539 
7540  /* "mprans/MeshSmoothing.pyx":472
7541  * double[:,:] elementBoundaryBarycentersArray,
7542  * double[:,:] elementBarycentersArray):
7543  * elementBoundaryNormalsArray_ = np.zeros(elementBoundariesArray.shape[0], 3, 3) # <<<<<<<<<<<<<<
7544  * cdef int nElements = len(elementBoundaryNormalsArray_)
7545  * pyxUpdateElementBoundaryNormalsTriangle(elementBoundaryNormalsArray_=elementBoundaryNormalsArray_,
7546  */
7547  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 472, __pyx_L1_error)
7548  __Pyx_GOTREF(__pyx_t_2);
7549  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 472, __pyx_L1_error)
7550  __Pyx_GOTREF(__pyx_t_3);
7551  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7552  __pyx_t_2 = PyInt_FromSsize_t((__pyx_v_elementBoundariesArray.shape[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 472, __pyx_L1_error)
7553  __Pyx_GOTREF(__pyx_t_2);
7554  __pyx_t_4 = NULL;
7555  __pyx_t_5 = 0;
7556  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
7557  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
7558  if (likely(__pyx_t_4)) {
7559  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
7560  __Pyx_INCREF(__pyx_t_4);
7561  __Pyx_INCREF(function);
7562  __Pyx_DECREF_SET(__pyx_t_3, function);
7563  __pyx_t_5 = 1;
7564  }
7565  }
7566  #if CYTHON_FAST_PYCALL
7567  if (PyFunction_Check(__pyx_t_3)) {
7568  PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_2, __pyx_int_3, __pyx_int_3};
7569  __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 472, __pyx_L1_error)
7570  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
7571  __Pyx_GOTREF(__pyx_t_1);
7572  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7573  } else
7574  #endif
7575  #if CYTHON_FAST_PYCCALL
7576  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
7577  PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_2, __pyx_int_3, __pyx_int_3};
7578  __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 472, __pyx_L1_error)
7579  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
7580  __Pyx_GOTREF(__pyx_t_1);
7581  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7582  } else
7583  #endif
7584  {
7585  __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 472, __pyx_L1_error)
7586  __Pyx_GOTREF(__pyx_t_6);
7587  if (__pyx_t_4) {
7588  __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
7589  }
7590  __Pyx_GIVEREF(__pyx_t_2);
7591  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_2);
7592  __Pyx_INCREF(__pyx_int_3);
7593  __Pyx_GIVEREF(__pyx_int_3);
7594  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_int_3);
7595  __Pyx_INCREF(__pyx_int_3);
7596  __Pyx_GIVEREF(__pyx_int_3);
7597  PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_int_3);
7598  __pyx_t_2 = 0;
7599  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 472, __pyx_L1_error)
7600  __Pyx_GOTREF(__pyx_t_1);
7601  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7602  }
7603  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7604  __pyx_v_elementBoundaryNormalsArray_ = __pyx_t_1;
7605  __pyx_t_1 = 0;
7606 
7607  /* "mprans/MeshSmoothing.pyx":473
7608  * double[:,:] elementBarycentersArray):
7609  * elementBoundaryNormalsArray_ = np.zeros(elementBoundariesArray.shape[0], 3, 3)
7610  * cdef int nElements = len(elementBoundaryNormalsArray_) # <<<<<<<<<<<<<<
7611  * pyxUpdateElementBoundaryNormalsTriangle(elementBoundaryNormalsArray_=elementBoundaryNormalsArray_,
7612  * nodeArray=nodeArray,
7613  */
7614  __pyx_t_7 = PyObject_Length(__pyx_v_elementBoundaryNormalsArray_); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 473, __pyx_L1_error)
7615  __pyx_v_nElements = __pyx_t_7;
7616 
7617  /* "mprans/MeshSmoothing.pyx":474
7618  * elementBoundaryNormalsArray_ = np.zeros(elementBoundariesArray.shape[0], 3, 3)
7619  * cdef int nElements = len(elementBoundaryNormalsArray_)
7620  * pyxUpdateElementBoundaryNormalsTriangle(elementBoundaryNormalsArray_=elementBoundaryNormalsArray_, # <<<<<<<<<<<<<<
7621  * nodeArray=nodeArray,
7622  * elementBoundariesArray=elementBoundariesArray,
7623  */
7624  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_v_elementBoundaryNormalsArray_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 474, __pyx_L1_error)
7625 
7626  /* "mprans/MeshSmoothing.pyx":480
7627  * elementBoundaryBarycentersArray=elementBoundaryBarycentersArray,
7628  * elementBarycentersArray=elementBarycentersArray,
7629  * nElements=nElements) # <<<<<<<<<<<<<<
7630  * return elementBoundaryNormalsArray_
7631  *
7632  */
7633  __pyx_f_6mprans_13MeshSmoothing_pyxUpdateElementBoundaryNormalsTriangle(__pyx_t_8, __pyx_v_nodeArray, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryNodesArray, __pyx_v_elementBoundaryBarycentersArray, __pyx_v_elementBarycentersArray, __pyx_v_nElements);
7634  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
7635  __pyx_t_8.memview = NULL;
7636  __pyx_t_8.data = NULL;
7637 
7638  /* "mprans/MeshSmoothing.pyx":481
7639  * elementBarycentersArray=elementBarycentersArray,
7640  * nElements=nElements)
7641  * return elementBoundaryNormalsArray_ # <<<<<<<<<<<<<<
7642  *
7643  * def updateElementBoundaryNormalsTetra(double[:,:,:] elementBoundaryNormalsArray_,
7644  */
7645  __Pyx_XDECREF(__pyx_r);
7646  __Pyx_INCREF(__pyx_v_elementBoundaryNormalsArray_);
7647  __pyx_r = __pyx_v_elementBoundaryNormalsArray_;
7648  goto __pyx_L0;
7649 
7650  /* "mprans/MeshSmoothing.pyx":467
7651  * nElements=nElements)
7652  *
7653  * def getElementBoundaryNormalsTriangle(double[:,:] nodeArray, # <<<<<<<<<<<<<<
7654  * int[:,:] elementBoundariesArray,
7655  * int[:,:] elementBoundaryNodesArray,
7656  */
7657 
7658  /* function exit code */
7659  __pyx_L1_error:;
7660  __Pyx_XDECREF(__pyx_t_1);
7661  __Pyx_XDECREF(__pyx_t_2);
7662  __Pyx_XDECREF(__pyx_t_3);
7663  __Pyx_XDECREF(__pyx_t_4);
7664  __Pyx_XDECREF(__pyx_t_6);
7665  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
7666  __Pyx_AddTraceback("mprans.MeshSmoothing.getElementBoundaryNormalsTriangle", __pyx_clineno, __pyx_lineno, __pyx_filename);
7667  __pyx_r = NULL;
7668  __pyx_L0:;
7669  __Pyx_XDECREF(__pyx_v_elementBoundaryNormalsArray_);
7670  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray, 1);
7671  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundariesArray, 1);
7672  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundaryNodesArray, 1);
7673  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundaryBarycentersArray, 1);
7674  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBarycentersArray, 1);
7675  __Pyx_XGIVEREF(__pyx_r);
7676  __Pyx_RefNannyFinishContext();
7677  return __pyx_r;
7678 }
7679 
7680 /* "mprans/MeshSmoothing.pyx":483
7681  * return elementBoundaryNormalsArray_
7682  *
7683  * def updateElementBoundaryNormalsTetra(double[:,:,:] elementBoundaryNormalsArray_, # <<<<<<<<<<<<<<
7684  * double[:,:] nodeArray,
7685  * int[:,:] elementBoundariesArray,
7686  */
7687 
7688 /* Python wrapper */
7689 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_39updateElementBoundaryNormalsTetra(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7690 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_39updateElementBoundaryNormalsTetra = {"updateElementBoundaryNormalsTetra", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_39updateElementBoundaryNormalsTetra, METH_VARARGS|METH_KEYWORDS, 0};
7691 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_39updateElementBoundaryNormalsTetra(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7692  __Pyx_memviewslice __pyx_v_elementBoundaryNormalsArray_ = { 0, 0, { 0 }, { 0 }, { 0 } };
7693  __Pyx_memviewslice __pyx_v_nodeArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7694  __Pyx_memviewslice __pyx_v_elementBoundariesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7695  __Pyx_memviewslice __pyx_v_elementBoundaryNodesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7696  __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7697  __Pyx_memviewslice __pyx_v_elementBarycentersArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7698  int __pyx_v_nElements;
7699  PyObject *__pyx_r = 0;
7700  __Pyx_RefNannyDeclarations
7701  __Pyx_RefNannySetupContext("updateElementBoundaryNormalsTetra (wrapper)", 0);
7702  {
7703  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementBoundaryNormalsArray_2,&__pyx_n_s_nodeArray_2,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryNodesArray,&__pyx_n_s_elementBoundaryBarycentersArray,&__pyx_n_s_elementBarycentersArray,&__pyx_n_s_nElements,0};
7704  PyObject* values[7] = {0,0,0,0,0,0,0};
7705  if (unlikely(__pyx_kwds)) {
7706  Py_ssize_t kw_args;
7707  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7708  switch (pos_args) {
7709  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
7710  CYTHON_FALLTHROUGH;
7711  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
7712  CYTHON_FALLTHROUGH;
7713  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7714  CYTHON_FALLTHROUGH;
7715  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7716  CYTHON_FALLTHROUGH;
7717  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7718  CYTHON_FALLTHROUGH;
7719  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7720  CYTHON_FALLTHROUGH;
7721  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7722  CYTHON_FALLTHROUGH;
7723  case 0: break;
7724  default: goto __pyx_L5_argtuple_error;
7725  }
7726  kw_args = PyDict_Size(__pyx_kwds);
7727  switch (pos_args) {
7728  case 0:
7729  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryNormalsArray_2)) != 0)) kw_args--;
7730  else goto __pyx_L5_argtuple_error;
7731  CYTHON_FALLTHROUGH;
7732  case 1:
7733  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeArray_2)) != 0)) kw_args--;
7734  else {
7735  __Pyx_RaiseArgtupleInvalid("updateElementBoundaryNormalsTetra", 1, 7, 7, 1); __PYX_ERR(0, 483, __pyx_L3_error)
7736  }
7737  CYTHON_FALLTHROUGH;
7738  case 2:
7739  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
7740  else {
7741  __Pyx_RaiseArgtupleInvalid("updateElementBoundaryNormalsTetra", 1, 7, 7, 2); __PYX_ERR(0, 483, __pyx_L3_error)
7742  }
7743  CYTHON_FALLTHROUGH;
7744  case 3:
7745  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryNodesArray)) != 0)) kw_args--;
7746  else {
7747  __Pyx_RaiseArgtupleInvalid("updateElementBoundaryNormalsTetra", 1, 7, 7, 3); __PYX_ERR(0, 483, __pyx_L3_error)
7748  }
7749  CYTHON_FALLTHROUGH;
7750  case 4:
7751  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryBarycentersArray)) != 0)) kw_args--;
7752  else {
7753  __Pyx_RaiseArgtupleInvalid("updateElementBoundaryNormalsTetra", 1, 7, 7, 4); __PYX_ERR(0, 483, __pyx_L3_error)
7754  }
7755  CYTHON_FALLTHROUGH;
7756  case 5:
7757  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
7758  else {
7759  __Pyx_RaiseArgtupleInvalid("updateElementBoundaryNormalsTetra", 1, 7, 7, 5); __PYX_ERR(0, 483, __pyx_L3_error)
7760  }
7761  CYTHON_FALLTHROUGH;
7762  case 6:
7763  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements)) != 0)) kw_args--;
7764  else {
7765  __Pyx_RaiseArgtupleInvalid("updateElementBoundaryNormalsTetra", 1, 7, 7, 6); __PYX_ERR(0, 483, __pyx_L3_error)
7766  }
7767  }
7768  if (unlikely(kw_args > 0)) {
7769  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "updateElementBoundaryNormalsTetra") < 0)) __PYX_ERR(0, 483, __pyx_L3_error)
7770  }
7771  } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
7772  goto __pyx_L5_argtuple_error;
7773  } else {
7774  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7775  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7776  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7777  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7778  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7779  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
7780  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
7781  }
7782  __pyx_v_elementBoundaryNormalsArray_ = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundaryNormalsArray_.memview)) __PYX_ERR(0, 483, __pyx_L3_error)
7783  __pyx_v_nodeArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeArray.memview)) __PYX_ERR(0, 484, __pyx_L3_error)
7784  __pyx_v_elementBoundariesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundariesArray.memview)) __PYX_ERR(0, 485, __pyx_L3_error)
7785  __pyx_v_elementBoundaryNodesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundaryNodesArray.memview)) __PYX_ERR(0, 486, __pyx_L3_error)
7786  __pyx_v_elementBoundaryBarycentersArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundaryBarycentersArray.memview)) __PYX_ERR(0, 487, __pyx_L3_error)
7787  __pyx_v_elementBarycentersArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBarycentersArray.memview)) __PYX_ERR(0, 488, __pyx_L3_error)
7788  __pyx_v_nElements = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_nElements == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 489, __pyx_L3_error)
7789  }
7790  goto __pyx_L4_argument_unpacking_done;
7791  __pyx_L5_argtuple_error:;
7792  __Pyx_RaiseArgtupleInvalid("updateElementBoundaryNormalsTetra", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 483, __pyx_L3_error)
7793  __pyx_L3_error:;
7794  __Pyx_AddTraceback("mprans.MeshSmoothing.updateElementBoundaryNormalsTetra", __pyx_clineno, __pyx_lineno, __pyx_filename);
7795  __Pyx_RefNannyFinishContext();
7796  return NULL;
7797  __pyx_L4_argument_unpacking_done:;
7798  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_38updateElementBoundaryNormalsTetra(__pyx_self, __pyx_v_elementBoundaryNormalsArray_, __pyx_v_nodeArray, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryNodesArray, __pyx_v_elementBoundaryBarycentersArray, __pyx_v_elementBarycentersArray, __pyx_v_nElements);
7799 
7800  /* function exit code */
7801  __Pyx_RefNannyFinishContext();
7802  return __pyx_r;
7803 }
7804 
7805 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_38updateElementBoundaryNormalsTetra(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_elementBoundaryNormalsArray_, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementBoundariesArray, __Pyx_memviewslice __pyx_v_elementBoundaryNodesArray, __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray, __Pyx_memviewslice __pyx_v_elementBarycentersArray, int __pyx_v_nElements) {
7806  PyObject *__pyx_r = NULL;
7807  __Pyx_RefNannyDeclarations
7808  __Pyx_RefNannySetupContext("updateElementBoundaryNormalsTetra", 0);
7809 
7810  /* "mprans/MeshSmoothing.pyx":490
7811  * double[:,:] elementBarycentersArray,
7812  * int nElements):
7813  * pyxUpdateElementBoundaryNormalsTetra(elementBoundaryNormalsArray_=elementBoundaryNormalsArray_, # <<<<<<<<<<<<<<
7814  * nodeArray=nodeArray,
7815  * elementBoundariesArray=elementBoundariesArray,
7816  */
7817  __pyx_f_6mprans_13MeshSmoothing_pyxUpdateElementBoundaryNormalsTetra(__pyx_v_elementBoundaryNormalsArray_, __pyx_v_nodeArray, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryNodesArray, __pyx_v_elementBoundaryBarycentersArray, __pyx_v_elementBarycentersArray, __pyx_v_nElements);
7818 
7819  /* "mprans/MeshSmoothing.pyx":483
7820  * return elementBoundaryNormalsArray_
7821  *
7822  * def updateElementBoundaryNormalsTetra(double[:,:,:] elementBoundaryNormalsArray_, # <<<<<<<<<<<<<<
7823  * double[:,:] nodeArray,
7824  * int[:,:] elementBoundariesArray,
7825  */
7826 
7827  /* function exit code */
7828  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7829  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundaryNormalsArray_, 1);
7830  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray, 1);
7831  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundariesArray, 1);
7832  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundaryNodesArray, 1);
7833  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundaryBarycentersArray, 1);
7834  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBarycentersArray, 1);
7835  __Pyx_XGIVEREF(__pyx_r);
7836  __Pyx_RefNannyFinishContext();
7837  return __pyx_r;
7838 }
7839 
7840 /* "mprans/MeshSmoothing.pyx":498
7841  * nElements=nElements)
7842  *
7843  * def getElementBoundaryNormalsTetra(double[:,:] nodeArray, # <<<<<<<<<<<<<<
7844  * int[:,:] elementBoundariesArray,
7845  * int[:,:] elementBoundaryNodesArray,
7846  */
7847 
7848 /* Python wrapper */
7849 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_41getElementBoundaryNormalsTetra(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7850 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_41getElementBoundaryNormalsTetra = {"getElementBoundaryNormalsTetra", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_41getElementBoundaryNormalsTetra, METH_VARARGS|METH_KEYWORDS, 0};
7851 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_41getElementBoundaryNormalsTetra(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7852  __Pyx_memviewslice __pyx_v_nodeArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7853  __Pyx_memviewslice __pyx_v_elementBoundariesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7854  __Pyx_memviewslice __pyx_v_elementBoundaryNodesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7855  __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7856  __Pyx_memviewslice __pyx_v_elementBarycentersArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7857  PyObject *__pyx_r = 0;
7858  __Pyx_RefNannyDeclarations
7859  __Pyx_RefNannySetupContext("getElementBoundaryNormalsTetra (wrapper)", 0);
7860  {
7861  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nodeArray_2,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryNodesArray,&__pyx_n_s_elementBoundaryBarycentersArray,&__pyx_n_s_elementBarycentersArray,0};
7862  PyObject* values[5] = {0,0,0,0,0};
7863  if (unlikely(__pyx_kwds)) {
7864  Py_ssize_t kw_args;
7865  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7866  switch (pos_args) {
7867  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7868  CYTHON_FALLTHROUGH;
7869  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7870  CYTHON_FALLTHROUGH;
7871  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7872  CYTHON_FALLTHROUGH;
7873  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7874  CYTHON_FALLTHROUGH;
7875  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7876  CYTHON_FALLTHROUGH;
7877  case 0: break;
7878  default: goto __pyx_L5_argtuple_error;
7879  }
7880  kw_args = PyDict_Size(__pyx_kwds);
7881  switch (pos_args) {
7882  case 0:
7883  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeArray_2)) != 0)) kw_args--;
7884  else goto __pyx_L5_argtuple_error;
7885  CYTHON_FALLTHROUGH;
7886  case 1:
7887  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
7888  else {
7889  __Pyx_RaiseArgtupleInvalid("getElementBoundaryNormalsTetra", 1, 5, 5, 1); __PYX_ERR(0, 498, __pyx_L3_error)
7890  }
7891  CYTHON_FALLTHROUGH;
7892  case 2:
7893  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryNodesArray)) != 0)) kw_args--;
7894  else {
7895  __Pyx_RaiseArgtupleInvalid("getElementBoundaryNormalsTetra", 1, 5, 5, 2); __PYX_ERR(0, 498, __pyx_L3_error)
7896  }
7897  CYTHON_FALLTHROUGH;
7898  case 3:
7899  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryBarycentersArray)) != 0)) kw_args--;
7900  else {
7901  __Pyx_RaiseArgtupleInvalid("getElementBoundaryNormalsTetra", 1, 5, 5, 3); __PYX_ERR(0, 498, __pyx_L3_error)
7902  }
7903  CYTHON_FALLTHROUGH;
7904  case 4:
7905  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
7906  else {
7907  __Pyx_RaiseArgtupleInvalid("getElementBoundaryNormalsTetra", 1, 5, 5, 4); __PYX_ERR(0, 498, __pyx_L3_error)
7908  }
7909  }
7910  if (unlikely(kw_args > 0)) {
7911  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getElementBoundaryNormalsTetra") < 0)) __PYX_ERR(0, 498, __pyx_L3_error)
7912  }
7913  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
7914  goto __pyx_L5_argtuple_error;
7915  } else {
7916  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7917  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7918  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7919  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7920  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7921  }
7922  __pyx_v_nodeArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeArray.memview)) __PYX_ERR(0, 498, __pyx_L3_error)
7923  __pyx_v_elementBoundariesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundariesArray.memview)) __PYX_ERR(0, 499, __pyx_L3_error)
7924  __pyx_v_elementBoundaryNodesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundaryNodesArray.memview)) __PYX_ERR(0, 500, __pyx_L3_error)
7925  __pyx_v_elementBoundaryBarycentersArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundaryBarycentersArray.memview)) __PYX_ERR(0, 501, __pyx_L3_error)
7926  __pyx_v_elementBarycentersArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBarycentersArray.memview)) __PYX_ERR(0, 502, __pyx_L3_error)
7927  }
7928  goto __pyx_L4_argument_unpacking_done;
7929  __pyx_L5_argtuple_error:;
7930  __Pyx_RaiseArgtupleInvalid("getElementBoundaryNormalsTetra", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 498, __pyx_L3_error)
7931  __pyx_L3_error:;
7932  __Pyx_AddTraceback("mprans.MeshSmoothing.getElementBoundaryNormalsTetra", __pyx_clineno, __pyx_lineno, __pyx_filename);
7933  __Pyx_RefNannyFinishContext();
7934  return NULL;
7935  __pyx_L4_argument_unpacking_done:;
7936  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_40getElementBoundaryNormalsTetra(__pyx_self, __pyx_v_nodeArray, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryNodesArray, __pyx_v_elementBoundaryBarycentersArray, __pyx_v_elementBarycentersArray);
7937 
7938  /* function exit code */
7939  __Pyx_RefNannyFinishContext();
7940  return __pyx_r;
7941 }
7942 
7943 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_40getElementBoundaryNormalsTetra(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementBoundariesArray, __Pyx_memviewslice __pyx_v_elementBoundaryNodesArray, __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray, __Pyx_memviewslice __pyx_v_elementBarycentersArray) {
7944  PyObject *__pyx_v_elementBoundaryNormalsArray_ = NULL;
7945  int __pyx_v_nElements;
7946  PyObject *__pyx_r = NULL;
7947  __Pyx_RefNannyDeclarations
7948  PyObject *__pyx_t_1 = NULL;
7949  PyObject *__pyx_t_2 = NULL;
7950  PyObject *__pyx_t_3 = NULL;
7951  PyObject *__pyx_t_4 = NULL;
7952  int __pyx_t_5;
7953  PyObject *__pyx_t_6 = NULL;
7954  Py_ssize_t __pyx_t_7;
7955  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
7956  __Pyx_RefNannySetupContext("getElementBoundaryNormalsTetra", 0);
7957 
7958  /* "mprans/MeshSmoothing.pyx":503
7959  * double[:,:] elementBoundaryBarycentersArray,
7960  * double[:,:] elementBarycentersArray):
7961  * elementBoundaryNormalsArray_ = np.zeros(elementBoundariesArray.shape[0], 4, 3) # <<<<<<<<<<<<<<
7962  * cdef int nElements = len(elementBoundaryNormalsArray_)
7963  * pyxUpdateElementBoundaryNormalsTetra(elementBoundaryNormalsArray_=elementBoundaryNormalsArray_,
7964  */
7965  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 503, __pyx_L1_error)
7966  __Pyx_GOTREF(__pyx_t_2);
7967  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 503, __pyx_L1_error)
7968  __Pyx_GOTREF(__pyx_t_3);
7969  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7970  __pyx_t_2 = PyInt_FromSsize_t((__pyx_v_elementBoundariesArray.shape[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 503, __pyx_L1_error)
7971  __Pyx_GOTREF(__pyx_t_2);
7972  __pyx_t_4 = NULL;
7973  __pyx_t_5 = 0;
7974  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
7975  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
7976  if (likely(__pyx_t_4)) {
7977  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
7978  __Pyx_INCREF(__pyx_t_4);
7979  __Pyx_INCREF(function);
7980  __Pyx_DECREF_SET(__pyx_t_3, function);
7981  __pyx_t_5 = 1;
7982  }
7983  }
7984  #if CYTHON_FAST_PYCALL
7985  if (PyFunction_Check(__pyx_t_3)) {
7986  PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_2, __pyx_int_4, __pyx_int_3};
7987  __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 503, __pyx_L1_error)
7988  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
7989  __Pyx_GOTREF(__pyx_t_1);
7990  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7991  } else
7992  #endif
7993  #if CYTHON_FAST_PYCCALL
7994  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
7995  PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_2, __pyx_int_4, __pyx_int_3};
7996  __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 503, __pyx_L1_error)
7997  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
7998  __Pyx_GOTREF(__pyx_t_1);
7999  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8000  } else
8001  #endif
8002  {
8003  __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 503, __pyx_L1_error)
8004  __Pyx_GOTREF(__pyx_t_6);
8005  if (__pyx_t_4) {
8006  __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
8007  }
8008  __Pyx_GIVEREF(__pyx_t_2);
8009  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_2);
8010  __Pyx_INCREF(__pyx_int_4);
8011  __Pyx_GIVEREF(__pyx_int_4);
8012  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_int_4);
8013  __Pyx_INCREF(__pyx_int_3);
8014  __Pyx_GIVEREF(__pyx_int_3);
8015  PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_int_3);
8016  __pyx_t_2 = 0;
8017  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 503, __pyx_L1_error)
8018  __Pyx_GOTREF(__pyx_t_1);
8019  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8020  }
8021  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8022  __pyx_v_elementBoundaryNormalsArray_ = __pyx_t_1;
8023  __pyx_t_1 = 0;
8024 
8025  /* "mprans/MeshSmoothing.pyx":504
8026  * double[:,:] elementBarycentersArray):
8027  * elementBoundaryNormalsArray_ = np.zeros(elementBoundariesArray.shape[0], 4, 3)
8028  * cdef int nElements = len(elementBoundaryNormalsArray_) # <<<<<<<<<<<<<<
8029  * pyxUpdateElementBoundaryNormalsTetra(elementBoundaryNormalsArray_=elementBoundaryNormalsArray_,
8030  * nodeArray=nodeArray,
8031  */
8032  __pyx_t_7 = PyObject_Length(__pyx_v_elementBoundaryNormalsArray_); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 504, __pyx_L1_error)
8033  __pyx_v_nElements = __pyx_t_7;
8034 
8035  /* "mprans/MeshSmoothing.pyx":505
8036  * elementBoundaryNormalsArray_ = np.zeros(elementBoundariesArray.shape[0], 4, 3)
8037  * cdef int nElements = len(elementBoundaryNormalsArray_)
8038  * pyxUpdateElementBoundaryNormalsTetra(elementBoundaryNormalsArray_=elementBoundaryNormalsArray_, # <<<<<<<<<<<<<<
8039  * nodeArray=nodeArray,
8040  * elementBoundariesArray=elementBoundariesArray,
8041  */
8042  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_v_elementBoundaryNormalsArray_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 505, __pyx_L1_error)
8043 
8044  /* "mprans/MeshSmoothing.pyx":511
8045  * elementBoundaryBarycentersArray=elementBoundaryBarycentersArray,
8046  * elementBarycentersArray=elementBarycentersArray,
8047  * nElements=nElements) # <<<<<<<<<<<<<<
8048  * return elementBoundaryNormalsArray_
8049  *
8050  */
8051  __pyx_f_6mprans_13MeshSmoothing_pyxUpdateElementBoundaryNormalsTetra(__pyx_t_8, __pyx_v_nodeArray, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryNodesArray, __pyx_v_elementBoundaryBarycentersArray, __pyx_v_elementBarycentersArray, __pyx_v_nElements);
8052  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
8053  __pyx_t_8.memview = NULL;
8054  __pyx_t_8.data = NULL;
8055 
8056  /* "mprans/MeshSmoothing.pyx":512
8057  * elementBarycentersArray=elementBarycentersArray,
8058  * nElements=nElements)
8059  * return elementBoundaryNormalsArray_ # <<<<<<<<<<<<<<
8060  *
8061  * def updateElementVolumesTriangle(double[:] elementVolumesArray_,
8062  */
8063  __Pyx_XDECREF(__pyx_r);
8064  __Pyx_INCREF(__pyx_v_elementBoundaryNormalsArray_);
8065  __pyx_r = __pyx_v_elementBoundaryNormalsArray_;
8066  goto __pyx_L0;
8067 
8068  /* "mprans/MeshSmoothing.pyx":498
8069  * nElements=nElements)
8070  *
8071  * def getElementBoundaryNormalsTetra(double[:,:] nodeArray, # <<<<<<<<<<<<<<
8072  * int[:,:] elementBoundariesArray,
8073  * int[:,:] elementBoundaryNodesArray,
8074  */
8075 
8076  /* function exit code */
8077  __pyx_L1_error:;
8078  __Pyx_XDECREF(__pyx_t_1);
8079  __Pyx_XDECREF(__pyx_t_2);
8080  __Pyx_XDECREF(__pyx_t_3);
8081  __Pyx_XDECREF(__pyx_t_4);
8082  __Pyx_XDECREF(__pyx_t_6);
8083  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
8084  __Pyx_AddTraceback("mprans.MeshSmoothing.getElementBoundaryNormalsTetra", __pyx_clineno, __pyx_lineno, __pyx_filename);
8085  __pyx_r = NULL;
8086  __pyx_L0:;
8087  __Pyx_XDECREF(__pyx_v_elementBoundaryNormalsArray_);
8088  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray, 1);
8089  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundariesArray, 1);
8090  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundaryNodesArray, 1);
8091  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundaryBarycentersArray, 1);
8092  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBarycentersArray, 1);
8093  __Pyx_XGIVEREF(__pyx_r);
8094  __Pyx_RefNannyFinishContext();
8095  return __pyx_r;
8096 }
8097 
8098 /* "mprans/MeshSmoothing.pyx":514
8099  * return elementBoundaryNormalsArray_
8100  *
8101  * def updateElementVolumesTriangle(double[:] elementVolumesArray_, # <<<<<<<<<<<<<<
8102  * int[:,:] elementNodesArray,
8103  * double[:,:] nodeArray,
8104  */
8105 
8106 /* Python wrapper */
8107 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_43updateElementVolumesTriangle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8108 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_43updateElementVolumesTriangle = {"updateElementVolumesTriangle", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_43updateElementVolumesTriangle, METH_VARARGS|METH_KEYWORDS, 0};
8109 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_43updateElementVolumesTriangle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8110  __Pyx_memviewslice __pyx_v_elementVolumesArray_ = { 0, 0, { 0 }, { 0 }, { 0 } };
8111  __Pyx_memviewslice __pyx_v_elementNodesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
8112  __Pyx_memviewslice __pyx_v_nodeArray = { 0, 0, { 0 }, { 0 }, { 0 } };
8113  int __pyx_v_nElements;
8114  PyObject *__pyx_r = 0;
8115  __Pyx_RefNannyDeclarations
8116  __Pyx_RefNannySetupContext("updateElementVolumesTriangle (wrapper)", 0);
8117  {
8118  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementVolumesArray_2,&__pyx_n_s_elementNodesArray,&__pyx_n_s_nodeArray_2,&__pyx_n_s_nElements,0};
8119  PyObject* values[4] = {0,0,0,0};
8120  if (unlikely(__pyx_kwds)) {
8121  Py_ssize_t kw_args;
8122  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8123  switch (pos_args) {
8124  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8125  CYTHON_FALLTHROUGH;
8126  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8127  CYTHON_FALLTHROUGH;
8128  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8129  CYTHON_FALLTHROUGH;
8130  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8131  CYTHON_FALLTHROUGH;
8132  case 0: break;
8133  default: goto __pyx_L5_argtuple_error;
8134  }
8135  kw_args = PyDict_Size(__pyx_kwds);
8136  switch (pos_args) {
8137  case 0:
8138  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementVolumesArray_2)) != 0)) kw_args--;
8139  else goto __pyx_L5_argtuple_error;
8140  CYTHON_FALLTHROUGH;
8141  case 1:
8142  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNodesArray)) != 0)) kw_args--;
8143  else {
8144  __Pyx_RaiseArgtupleInvalid("updateElementVolumesTriangle", 1, 4, 4, 1); __PYX_ERR(0, 514, __pyx_L3_error)
8145  }
8146  CYTHON_FALLTHROUGH;
8147  case 2:
8148  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeArray_2)) != 0)) kw_args--;
8149  else {
8150  __Pyx_RaiseArgtupleInvalid("updateElementVolumesTriangle", 1, 4, 4, 2); __PYX_ERR(0, 514, __pyx_L3_error)
8151  }
8152  CYTHON_FALLTHROUGH;
8153  case 3:
8154  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements)) != 0)) kw_args--;
8155  else {
8156  __Pyx_RaiseArgtupleInvalid("updateElementVolumesTriangle", 1, 4, 4, 3); __PYX_ERR(0, 514, __pyx_L3_error)
8157  }
8158  }
8159  if (unlikely(kw_args > 0)) {
8160  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "updateElementVolumesTriangle") < 0)) __PYX_ERR(0, 514, __pyx_L3_error)
8161  }
8162  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
8163  goto __pyx_L5_argtuple_error;
8164  } else {
8165  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8166  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8167  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8168  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8169  }
8170  __pyx_v_elementVolumesArray_ = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementVolumesArray_.memview)) __PYX_ERR(0, 514, __pyx_L3_error)
8171  __pyx_v_elementNodesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementNodesArray.memview)) __PYX_ERR(0, 515, __pyx_L3_error)
8172  __pyx_v_nodeArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeArray.memview)) __PYX_ERR(0, 516, __pyx_L3_error)
8173  __pyx_v_nElements = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nElements == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 517, __pyx_L3_error)
8174  }
8175  goto __pyx_L4_argument_unpacking_done;
8176  __pyx_L5_argtuple_error:;
8177  __Pyx_RaiseArgtupleInvalid("updateElementVolumesTriangle", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 514, __pyx_L3_error)
8178  __pyx_L3_error:;
8179  __Pyx_AddTraceback("mprans.MeshSmoothing.updateElementVolumesTriangle", __pyx_clineno, __pyx_lineno, __pyx_filename);
8180  __Pyx_RefNannyFinishContext();
8181  return NULL;
8182  __pyx_L4_argument_unpacking_done:;
8183  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_42updateElementVolumesTriangle(__pyx_self, __pyx_v_elementVolumesArray_, __pyx_v_elementNodesArray, __pyx_v_nodeArray, __pyx_v_nElements);
8184 
8185  /* function exit code */
8186  __Pyx_RefNannyFinishContext();
8187  return __pyx_r;
8188 }
8189 
8190 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_42updateElementVolumesTriangle(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_elementVolumesArray_, __Pyx_memviewslice __pyx_v_elementNodesArray, __Pyx_memviewslice __pyx_v_nodeArray, int __pyx_v_nElements) {
8191  PyObject *__pyx_r = NULL;
8192  __Pyx_RefNannyDeclarations
8193  __Pyx_RefNannySetupContext("updateElementVolumesTriangle", 0);
8194 
8195  /* "mprans/MeshSmoothing.pyx":518
8196  * double[:,:] nodeArray,
8197  * int nElements):
8198  * cyUpdateElementVolumesTriangle(elementVolumesArray_=elementVolumesArray_, # <<<<<<<<<<<<<<
8199  * elementNodesArray=elementNodesArray,
8200  * nodeArray=nodeArray,
8201  */
8202  __pyx_f_6mprans_13MeshSmoothing_cyUpdateElementVolumesTriangle(__pyx_v_elementVolumesArray_, __pyx_v_elementNodesArray, __pyx_v_nodeArray, __pyx_v_nElements);
8203 
8204  /* "mprans/MeshSmoothing.pyx":514
8205  * return elementBoundaryNormalsArray_
8206  *
8207  * def updateElementVolumesTriangle(double[:] elementVolumesArray_, # <<<<<<<<<<<<<<
8208  * int[:,:] elementNodesArray,
8209  * double[:,:] nodeArray,
8210  */
8211 
8212  /* function exit code */
8213  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8214  __PYX_XDEC_MEMVIEW(&__pyx_v_elementVolumesArray_, 1);
8215  __PYX_XDEC_MEMVIEW(&__pyx_v_elementNodesArray, 1);
8216  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray, 1);
8217  __Pyx_XGIVEREF(__pyx_r);
8218  __Pyx_RefNannyFinishContext();
8219  return __pyx_r;
8220 }
8221 
8222 /* "mprans/MeshSmoothing.pyx":523
8223  * nElements=nElements)
8224  *
8225  * def getElementVolumeTriangle(double[:] nA, # <<<<<<<<<<<<<<
8226  * double[:] nB,
8227  * double[:] nC):
8228  */
8229 
8230 /* Python wrapper */
8231 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_45getElementVolumeTriangle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8232 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_45getElementVolumeTriangle = {"getElementVolumeTriangle", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_45getElementVolumeTriangle, METH_VARARGS|METH_KEYWORDS, 0};
8233 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_45getElementVolumeTriangle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8234  __Pyx_memviewslice __pyx_v_nA = { 0, 0, { 0 }, { 0 }, { 0 } };
8235  __Pyx_memviewslice __pyx_v_nB = { 0, 0, { 0 }, { 0 }, { 0 } };
8236  __Pyx_memviewslice __pyx_v_nC = { 0, 0, { 0 }, { 0 }, { 0 } };
8237  PyObject *__pyx_r = 0;
8238  __Pyx_RefNannyDeclarations
8239  __Pyx_RefNannySetupContext("getElementVolumeTriangle (wrapper)", 0);
8240  {
8241  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nA,&__pyx_n_s_nB,&__pyx_n_s_nC,0};
8242  PyObject* values[3] = {0,0,0};
8243  if (unlikely(__pyx_kwds)) {
8244  Py_ssize_t kw_args;
8245  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8246  switch (pos_args) {
8247  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8248  CYTHON_FALLTHROUGH;
8249  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8250  CYTHON_FALLTHROUGH;
8251  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8252  CYTHON_FALLTHROUGH;
8253  case 0: break;
8254  default: goto __pyx_L5_argtuple_error;
8255  }
8256  kw_args = PyDict_Size(__pyx_kwds);
8257  switch (pos_args) {
8258  case 0:
8259  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nA)) != 0)) kw_args--;
8260  else goto __pyx_L5_argtuple_error;
8261  CYTHON_FALLTHROUGH;
8262  case 1:
8263  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nB)) != 0)) kw_args--;
8264  else {
8265  __Pyx_RaiseArgtupleInvalid("getElementVolumeTriangle", 1, 3, 3, 1); __PYX_ERR(0, 523, __pyx_L3_error)
8266  }
8267  CYTHON_FALLTHROUGH;
8268  case 2:
8269  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nC)) != 0)) kw_args--;
8270  else {
8271  __Pyx_RaiseArgtupleInvalid("getElementVolumeTriangle", 1, 3, 3, 2); __PYX_ERR(0, 523, __pyx_L3_error)
8272  }
8273  }
8274  if (unlikely(kw_args > 0)) {
8275  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getElementVolumeTriangle") < 0)) __PYX_ERR(0, 523, __pyx_L3_error)
8276  }
8277  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
8278  goto __pyx_L5_argtuple_error;
8279  } else {
8280  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8281  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8282  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8283  }
8284  __pyx_v_nA = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nA.memview)) __PYX_ERR(0, 523, __pyx_L3_error)
8285  __pyx_v_nB = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nB.memview)) __PYX_ERR(0, 524, __pyx_L3_error)
8286  __pyx_v_nC = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nC.memview)) __PYX_ERR(0, 525, __pyx_L3_error)
8287  }
8288  goto __pyx_L4_argument_unpacking_done;
8289  __pyx_L5_argtuple_error:;
8290  __Pyx_RaiseArgtupleInvalid("getElementVolumeTriangle", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 523, __pyx_L3_error)
8291  __pyx_L3_error:;
8292  __Pyx_AddTraceback("mprans.MeshSmoothing.getElementVolumeTriangle", __pyx_clineno, __pyx_lineno, __pyx_filename);
8293  __Pyx_RefNannyFinishContext();
8294  return NULL;
8295  __pyx_L4_argument_unpacking_done:;
8296  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_44getElementVolumeTriangle(__pyx_self, __pyx_v_nA, __pyx_v_nB, __pyx_v_nC);
8297 
8298  /* function exit code */
8299  __Pyx_RefNannyFinishContext();
8300  return __pyx_r;
8301 }
8302 
8303 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_44getElementVolumeTriangle(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_nA, __Pyx_memviewslice __pyx_v_nB, __Pyx_memviewslice __pyx_v_nC) {
8304  PyObject *__pyx_r = NULL;
8305  __Pyx_RefNannyDeclarations
8306  PyObject *__pyx_t_1 = NULL;
8307  __Pyx_RefNannySetupContext("getElementVolumeTriangle", 0);
8308 
8309  /* "mprans/MeshSmoothing.pyx":526
8310  * double[:] nB,
8311  * double[:] nC):
8312  * return cyGetElementVolumeTriangle(nA=nA, # <<<<<<<<<<<<<<
8313  * nB=nB,
8314  * nC=nC)
8315  */
8316  __Pyx_XDECREF(__pyx_r);
8317 
8318  /* "mprans/MeshSmoothing.pyx":528
8319  * return cyGetElementVolumeTriangle(nA=nA,
8320  * nB=nB,
8321  * nC=nC) # <<<<<<<<<<<<<<
8322  *
8323  * def updateElementVolumesTetra(double[:] elementVolumesArray_,
8324  */
8325  __pyx_t_1 = PyFloat_FromDouble(__pyx_f_6mprans_13MeshSmoothing_cyGetElementVolumeTriangle(__pyx_v_nA, __pyx_v_nB, __pyx_v_nC)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 526, __pyx_L1_error)
8326  __Pyx_GOTREF(__pyx_t_1);
8327  __pyx_r = __pyx_t_1;
8328  __pyx_t_1 = 0;
8329  goto __pyx_L0;
8330 
8331  /* "mprans/MeshSmoothing.pyx":523
8332  * nElements=nElements)
8333  *
8334  * def getElementVolumeTriangle(double[:] nA, # <<<<<<<<<<<<<<
8335  * double[:] nB,
8336  * double[:] nC):
8337  */
8338 
8339  /* function exit code */
8340  __pyx_L1_error:;
8341  __Pyx_XDECREF(__pyx_t_1);
8342  __Pyx_AddTraceback("mprans.MeshSmoothing.getElementVolumeTriangle", __pyx_clineno, __pyx_lineno, __pyx_filename);
8343  __pyx_r = NULL;
8344  __pyx_L0:;
8345  __PYX_XDEC_MEMVIEW(&__pyx_v_nA, 1);
8346  __PYX_XDEC_MEMVIEW(&__pyx_v_nB, 1);
8347  __PYX_XDEC_MEMVIEW(&__pyx_v_nC, 1);
8348  __Pyx_XGIVEREF(__pyx_r);
8349  __Pyx_RefNannyFinishContext();
8350  return __pyx_r;
8351 }
8352 
8353 /* "mprans/MeshSmoothing.pyx":530
8354  * nC=nC)
8355  *
8356  * def updateElementVolumesTetra(double[:] elementVolumesArray_, # <<<<<<<<<<<<<<
8357  * int[:,:] elementNodesArray,
8358  * double[:,:] nodeArray,
8359  */
8360 
8361 /* Python wrapper */
8362 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_47updateElementVolumesTetra(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8363 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_47updateElementVolumesTetra = {"updateElementVolumesTetra", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_47updateElementVolumesTetra, METH_VARARGS|METH_KEYWORDS, 0};
8364 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_47updateElementVolumesTetra(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8365  __Pyx_memviewslice __pyx_v_elementVolumesArray_ = { 0, 0, { 0 }, { 0 }, { 0 } };
8366  __Pyx_memviewslice __pyx_v_elementNodesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
8367  __Pyx_memviewslice __pyx_v_nodeArray = { 0, 0, { 0 }, { 0 }, { 0 } };
8368  int __pyx_v_nElements;
8369  PyObject *__pyx_r = 0;
8370  __Pyx_RefNannyDeclarations
8371  __Pyx_RefNannySetupContext("updateElementVolumesTetra (wrapper)", 0);
8372  {
8373  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementVolumesArray_2,&__pyx_n_s_elementNodesArray,&__pyx_n_s_nodeArray_2,&__pyx_n_s_nElements,0};
8374  PyObject* values[4] = {0,0,0,0};
8375  if (unlikely(__pyx_kwds)) {
8376  Py_ssize_t kw_args;
8377  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8378  switch (pos_args) {
8379  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8380  CYTHON_FALLTHROUGH;
8381  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8382  CYTHON_FALLTHROUGH;
8383  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8384  CYTHON_FALLTHROUGH;
8385  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8386  CYTHON_FALLTHROUGH;
8387  case 0: break;
8388  default: goto __pyx_L5_argtuple_error;
8389  }
8390  kw_args = PyDict_Size(__pyx_kwds);
8391  switch (pos_args) {
8392  case 0:
8393  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementVolumesArray_2)) != 0)) kw_args--;
8394  else goto __pyx_L5_argtuple_error;
8395  CYTHON_FALLTHROUGH;
8396  case 1:
8397  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNodesArray)) != 0)) kw_args--;
8398  else {
8399  __Pyx_RaiseArgtupleInvalid("updateElementVolumesTetra", 1, 4, 4, 1); __PYX_ERR(0, 530, __pyx_L3_error)
8400  }
8401  CYTHON_FALLTHROUGH;
8402  case 2:
8403  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeArray_2)) != 0)) kw_args--;
8404  else {
8405  __Pyx_RaiseArgtupleInvalid("updateElementVolumesTetra", 1, 4, 4, 2); __PYX_ERR(0, 530, __pyx_L3_error)
8406  }
8407  CYTHON_FALLTHROUGH;
8408  case 3:
8409  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements)) != 0)) kw_args--;
8410  else {
8411  __Pyx_RaiseArgtupleInvalid("updateElementVolumesTetra", 1, 4, 4, 3); __PYX_ERR(0, 530, __pyx_L3_error)
8412  }
8413  }
8414  if (unlikely(kw_args > 0)) {
8415  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "updateElementVolumesTetra") < 0)) __PYX_ERR(0, 530, __pyx_L3_error)
8416  }
8417  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
8418  goto __pyx_L5_argtuple_error;
8419  } else {
8420  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8421  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8422  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8423  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8424  }
8425  __pyx_v_elementVolumesArray_ = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementVolumesArray_.memview)) __PYX_ERR(0, 530, __pyx_L3_error)
8426  __pyx_v_elementNodesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementNodesArray.memview)) __PYX_ERR(0, 531, __pyx_L3_error)
8427  __pyx_v_nodeArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeArray.memview)) __PYX_ERR(0, 532, __pyx_L3_error)
8428  __pyx_v_nElements = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nElements == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 533, __pyx_L3_error)
8429  }
8430  goto __pyx_L4_argument_unpacking_done;
8431  __pyx_L5_argtuple_error:;
8432  __Pyx_RaiseArgtupleInvalid("updateElementVolumesTetra", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 530, __pyx_L3_error)
8433  __pyx_L3_error:;
8434  __Pyx_AddTraceback("mprans.MeshSmoothing.updateElementVolumesTetra", __pyx_clineno, __pyx_lineno, __pyx_filename);
8435  __Pyx_RefNannyFinishContext();
8436  return NULL;
8437  __pyx_L4_argument_unpacking_done:;
8438  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_46updateElementVolumesTetra(__pyx_self, __pyx_v_elementVolumesArray_, __pyx_v_elementNodesArray, __pyx_v_nodeArray, __pyx_v_nElements);
8439 
8440  /* function exit code */
8441  __Pyx_RefNannyFinishContext();
8442  return __pyx_r;
8443 }
8444 
8445 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_46updateElementVolumesTetra(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_elementVolumesArray_, __Pyx_memviewslice __pyx_v_elementNodesArray, __Pyx_memviewslice __pyx_v_nodeArray, int __pyx_v_nElements) {
8446  PyObject *__pyx_r = NULL;
8447  __Pyx_RefNannyDeclarations
8448  __Pyx_RefNannySetupContext("updateElementVolumesTetra", 0);
8449 
8450  /* "mprans/MeshSmoothing.pyx":534
8451  * double[:,:] nodeArray,
8452  * int nElements):
8453  * cyUpdateElementVolumesTetra(elementVolumesArray_=elementVolumesArray_, # <<<<<<<<<<<<<<
8454  * elementNodesArray=elementNodesArray,
8455  * nodeArray=nodeArray,
8456  */
8457  __pyx_f_6mprans_13MeshSmoothing_cyUpdateElementVolumesTetra(__pyx_v_elementVolumesArray_, __pyx_v_elementNodesArray, __pyx_v_nodeArray, __pyx_v_nElements);
8458 
8459  /* "mprans/MeshSmoothing.pyx":530
8460  * nC=nC)
8461  *
8462  * def updateElementVolumesTetra(double[:] elementVolumesArray_, # <<<<<<<<<<<<<<
8463  * int[:,:] elementNodesArray,
8464  * double[:,:] nodeArray,
8465  */
8466 
8467  /* function exit code */
8468  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8469  __PYX_XDEC_MEMVIEW(&__pyx_v_elementVolumesArray_, 1);
8470  __PYX_XDEC_MEMVIEW(&__pyx_v_elementNodesArray, 1);
8471  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray, 1);
8472  __Pyx_XGIVEREF(__pyx_r);
8473  __Pyx_RefNannyFinishContext();
8474  return __pyx_r;
8475 }
8476 
8477 /* "mprans/MeshSmoothing.pyx":539
8478  * nElements=nElements)
8479  *
8480  * def updateElementBarycenters(double[:,:] elementBarycentersArray_, # <<<<<<<<<<<<<<
8481  * int[:,:] elementNodesArray,
8482  * double[:,:] nodeArray,
8483  */
8484 
8485 /* Python wrapper */
8486 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_49updateElementBarycenters(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8487 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_49updateElementBarycenters = {"updateElementBarycenters", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_49updateElementBarycenters, METH_VARARGS|METH_KEYWORDS, 0};
8488 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_49updateElementBarycenters(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8489  __Pyx_memviewslice __pyx_v_elementBarycentersArray_ = { 0, 0, { 0 }, { 0 }, { 0 } };
8490  __Pyx_memviewslice __pyx_v_elementNodesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
8491  __Pyx_memviewslice __pyx_v_nodeArray = { 0, 0, { 0 }, { 0 }, { 0 } };
8492  int __pyx_v_nElements;
8493  PyObject *__pyx_r = 0;
8494  __Pyx_RefNannyDeclarations
8495  __Pyx_RefNannySetupContext("updateElementBarycenters (wrapper)", 0);
8496  {
8497  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementBarycentersArray_2,&__pyx_n_s_elementNodesArray,&__pyx_n_s_nodeArray_2,&__pyx_n_s_nElements,0};
8498  PyObject* values[4] = {0,0,0,0};
8499  if (unlikely(__pyx_kwds)) {
8500  Py_ssize_t kw_args;
8501  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8502  switch (pos_args) {
8503  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8504  CYTHON_FALLTHROUGH;
8505  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8506  CYTHON_FALLTHROUGH;
8507  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8508  CYTHON_FALLTHROUGH;
8509  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8510  CYTHON_FALLTHROUGH;
8511  case 0: break;
8512  default: goto __pyx_L5_argtuple_error;
8513  }
8514  kw_args = PyDict_Size(__pyx_kwds);
8515  switch (pos_args) {
8516  case 0:
8517  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBarycentersArray_2)) != 0)) kw_args--;
8518  else goto __pyx_L5_argtuple_error;
8519  CYTHON_FALLTHROUGH;
8520  case 1:
8521  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNodesArray)) != 0)) kw_args--;
8522  else {
8523  __Pyx_RaiseArgtupleInvalid("updateElementBarycenters", 1, 4, 4, 1); __PYX_ERR(0, 539, __pyx_L3_error)
8524  }
8525  CYTHON_FALLTHROUGH;
8526  case 2:
8527  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeArray_2)) != 0)) kw_args--;
8528  else {
8529  __Pyx_RaiseArgtupleInvalid("updateElementBarycenters", 1, 4, 4, 2); __PYX_ERR(0, 539, __pyx_L3_error)
8530  }
8531  CYTHON_FALLTHROUGH;
8532  case 3:
8533  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements)) != 0)) kw_args--;
8534  else {
8535  __Pyx_RaiseArgtupleInvalid("updateElementBarycenters", 1, 4, 4, 3); __PYX_ERR(0, 539, __pyx_L3_error)
8536  }
8537  }
8538  if (unlikely(kw_args > 0)) {
8539  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "updateElementBarycenters") < 0)) __PYX_ERR(0, 539, __pyx_L3_error)
8540  }
8541  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
8542  goto __pyx_L5_argtuple_error;
8543  } else {
8544  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8545  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8546  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8547  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8548  }
8549  __pyx_v_elementBarycentersArray_ = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBarycentersArray_.memview)) __PYX_ERR(0, 539, __pyx_L3_error)
8550  __pyx_v_elementNodesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementNodesArray.memview)) __PYX_ERR(0, 540, __pyx_L3_error)
8551  __pyx_v_nodeArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeArray.memview)) __PYX_ERR(0, 541, __pyx_L3_error)
8552  __pyx_v_nElements = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nElements == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 542, __pyx_L3_error)
8553  }
8554  goto __pyx_L4_argument_unpacking_done;
8555  __pyx_L5_argtuple_error:;
8556  __Pyx_RaiseArgtupleInvalid("updateElementBarycenters", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 539, __pyx_L3_error)
8557  __pyx_L3_error:;
8558  __Pyx_AddTraceback("mprans.MeshSmoothing.updateElementBarycenters", __pyx_clineno, __pyx_lineno, __pyx_filename);
8559  __Pyx_RefNannyFinishContext();
8560  return NULL;
8561  __pyx_L4_argument_unpacking_done:;
8562  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_48updateElementBarycenters(__pyx_self, __pyx_v_elementBarycentersArray_, __pyx_v_elementNodesArray, __pyx_v_nodeArray, __pyx_v_nElements);
8563 
8564  /* function exit code */
8565  __Pyx_RefNannyFinishContext();
8566  return __pyx_r;
8567 }
8568 
8569 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_48updateElementBarycenters(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_elementBarycentersArray_, __Pyx_memviewslice __pyx_v_elementNodesArray, __Pyx_memviewslice __pyx_v_nodeArray, int __pyx_v_nElements) {
8570  PyObject *__pyx_r = NULL;
8571  __Pyx_RefNannyDeclarations
8572  __Pyx_RefNannySetupContext("updateElementBarycenters", 0);
8573 
8574  /* "mprans/MeshSmoothing.pyx":543
8575  * double[:,:] nodeArray,
8576  * int nElements):
8577  * cyUpdateElementBarycenters(elementBarycentersArray_=elementBarycentersArray_, # <<<<<<<<<<<<<<
8578  * elementNodesArray=elementNodesArray,
8579  * nodeArray=nodeArray,
8580  */
8581  __pyx_f_6mprans_13MeshSmoothing_cyUpdateElementBarycenters(__pyx_v_elementBarycentersArray_, __pyx_v_elementNodesArray, __pyx_v_nodeArray, __pyx_v_nElements);
8582 
8583  /* "mprans/MeshSmoothing.pyx":539
8584  * nElements=nElements)
8585  *
8586  * def updateElementBarycenters(double[:,:] elementBarycentersArray_, # <<<<<<<<<<<<<<
8587  * int[:,:] elementNodesArray,
8588  * double[:,:] nodeArray,
8589  */
8590 
8591  /* function exit code */
8592  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8593  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBarycentersArray_, 1);
8594  __PYX_XDEC_MEMVIEW(&__pyx_v_elementNodesArray, 1);
8595  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray, 1);
8596  __Pyx_XGIVEREF(__pyx_r);
8597  __Pyx_RefNannyFinishContext();
8598  return __pyx_r;
8599 }
8600 
8601 /* "mprans/MeshSmoothing.pyx":548
8602  * nElements=nElements)
8603  *
8604  * def getCornerNodesTriangle(double[:,:] nodeArray, # <<<<<<<<<<<<<<
8605  * int[:] nodeStarArray,
8606  * int[:] nodeStarOffsets,
8607  */
8608 
8609 /* Python wrapper */
8610 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_51getCornerNodesTriangle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8611 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_51getCornerNodesTriangle = {"getCornerNodesTriangle", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_51getCornerNodesTriangle, METH_VARARGS|METH_KEYWORDS, 0};
8612 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_51getCornerNodesTriangle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8613  __Pyx_memviewslice __pyx_v_nodeArray = { 0, 0, { 0 }, { 0 }, { 0 } };
8614  __Pyx_memviewslice __pyx_v_nodeStarArray = { 0, 0, { 0 }, { 0 }, { 0 } };
8615  __Pyx_memviewslice __pyx_v_nodeStarOffsets = { 0, 0, { 0 }, { 0 }, { 0 } };
8616  __Pyx_memviewslice __pyx_v_nodeMaterialTypes = { 0, 0, { 0 }, { 0 }, { 0 } };
8617  int __pyx_v_nNodes;
8618  PyObject *__pyx_r = 0;
8619  __Pyx_RefNannyDeclarations
8620  __Pyx_RefNannySetupContext("getCornerNodesTriangle (wrapper)", 0);
8621  {
8622  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nodeArray_2,&__pyx_n_s_nodeStarArray,&__pyx_n_s_nodeStarOffsets,&__pyx_n_s_nodeMaterialTypes,&__pyx_n_s_nNodes,0};
8623  PyObject* values[5] = {0,0,0,0,0};
8624  if (unlikely(__pyx_kwds)) {
8625  Py_ssize_t kw_args;
8626  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8627  switch (pos_args) {
8628  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8629  CYTHON_FALLTHROUGH;
8630  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8631  CYTHON_FALLTHROUGH;
8632  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8633  CYTHON_FALLTHROUGH;
8634  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8635  CYTHON_FALLTHROUGH;
8636  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8637  CYTHON_FALLTHROUGH;
8638  case 0: break;
8639  default: goto __pyx_L5_argtuple_error;
8640  }
8641  kw_args = PyDict_Size(__pyx_kwds);
8642  switch (pos_args) {
8643  case 0:
8644  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeArray_2)) != 0)) kw_args--;
8645  else goto __pyx_L5_argtuple_error;
8646  CYTHON_FALLTHROUGH;
8647  case 1:
8648  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeStarArray)) != 0)) kw_args--;
8649  else {
8650  __Pyx_RaiseArgtupleInvalid("getCornerNodesTriangle", 1, 5, 5, 1); __PYX_ERR(0, 548, __pyx_L3_error)
8651  }
8652  CYTHON_FALLTHROUGH;
8653  case 2:
8654  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeStarOffsets)) != 0)) kw_args--;
8655  else {
8656  __Pyx_RaiseArgtupleInvalid("getCornerNodesTriangle", 1, 5, 5, 2); __PYX_ERR(0, 548, __pyx_L3_error)
8657  }
8658  CYTHON_FALLTHROUGH;
8659  case 3:
8660  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeMaterialTypes)) != 0)) kw_args--;
8661  else {
8662  __Pyx_RaiseArgtupleInvalid("getCornerNodesTriangle", 1, 5, 5, 3); __PYX_ERR(0, 548, __pyx_L3_error)
8663  }
8664  CYTHON_FALLTHROUGH;
8665  case 4:
8666  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nNodes)) != 0)) kw_args--;
8667  else {
8668  __Pyx_RaiseArgtupleInvalid("getCornerNodesTriangle", 1, 5, 5, 4); __PYX_ERR(0, 548, __pyx_L3_error)
8669  }
8670  }
8671  if (unlikely(kw_args > 0)) {
8672  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getCornerNodesTriangle") < 0)) __PYX_ERR(0, 548, __pyx_L3_error)
8673  }
8674  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
8675  goto __pyx_L5_argtuple_error;
8676  } else {
8677  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8678  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8679  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8680  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8681  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8682  }
8683  __pyx_v_nodeArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeArray.memview)) __PYX_ERR(0, 548, __pyx_L3_error)
8684  __pyx_v_nodeStarArray = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeStarArray.memview)) __PYX_ERR(0, 549, __pyx_L3_error)
8685  __pyx_v_nodeStarOffsets = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeStarOffsets.memview)) __PYX_ERR(0, 550, __pyx_L3_error)
8686  __pyx_v_nodeMaterialTypes = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeMaterialTypes.memview)) __PYX_ERR(0, 551, __pyx_L3_error)
8687  __pyx_v_nNodes = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_nNodes == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 552, __pyx_L3_error)
8688  }
8689  goto __pyx_L4_argument_unpacking_done;
8690  __pyx_L5_argtuple_error:;
8691  __Pyx_RaiseArgtupleInvalid("getCornerNodesTriangle", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 548, __pyx_L3_error)
8692  __pyx_L3_error:;
8693  __Pyx_AddTraceback("mprans.MeshSmoothing.getCornerNodesTriangle", __pyx_clineno, __pyx_lineno, __pyx_filename);
8694  __Pyx_RefNannyFinishContext();
8695  return NULL;
8696  __pyx_L4_argument_unpacking_done:;
8697  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_50getCornerNodesTriangle(__pyx_self, __pyx_v_nodeArray, __pyx_v_nodeStarArray, __pyx_v_nodeStarOffsets, __pyx_v_nodeMaterialTypes, __pyx_v_nNodes);
8698 
8699  /* function exit code */
8700  __Pyx_RefNannyFinishContext();
8701  return __pyx_r;
8702 }
8703 
8704 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_50getCornerNodesTriangle(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_nodeStarArray, __Pyx_memviewslice __pyx_v_nodeStarOffsets, __Pyx_memviewslice __pyx_v_nodeMaterialTypes, int __pyx_v_nNodes) {
8705  PyObject *__pyx_r = NULL;
8706  __Pyx_RefNannyDeclarations
8707  PyObject *__pyx_t_1 = NULL;
8708  __Pyx_RefNannySetupContext("getCornerNodesTriangle", 0);
8709 
8710  /* "mprans/MeshSmoothing.pyx":553
8711  * int[:] nodeMaterialTypes,
8712  * int nNodes):
8713  * return cyGetCornerNodesTriangle(nodeArray=nodeArray, # <<<<<<<<<<<<<<
8714  * nodeStarArray=nodeStarArray,
8715  * nodeStarOffsets=nodeStarOffsets,
8716  */
8717  __Pyx_XDECREF(__pyx_r);
8718 
8719  /* "mprans/MeshSmoothing.pyx":557
8720  * nodeStarOffsets=nodeStarOffsets,
8721  * nodeMaterialTypes=nodeMaterialTypes,
8722  * nNodes=nNodes) # <<<<<<<<<<<<<<
8723  *
8724  * def getNonOwnedNodeValues(args_,
8725  */
8726  __pyx_t_1 = ((PyObject *)__pyx_f_6mprans_13MeshSmoothing_cyGetCornerNodesTriangle(__pyx_v_nodeArray, __pyx_v_nodeStarArray, __pyx_v_nodeStarOffsets, __pyx_v_nodeMaterialTypes, __pyx_v_nNodes)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 553, __pyx_L1_error)
8727  __Pyx_GOTREF(__pyx_t_1);
8728  __pyx_r = __pyx_t_1;
8729  __pyx_t_1 = 0;
8730  goto __pyx_L0;
8731 
8732  /* "mprans/MeshSmoothing.pyx":548
8733  * nElements=nElements)
8734  *
8735  * def getCornerNodesTriangle(double[:,:] nodeArray, # <<<<<<<<<<<<<<
8736  * int[:] nodeStarArray,
8737  * int[:] nodeStarOffsets,
8738  */
8739 
8740  /* function exit code */
8741  __pyx_L1_error:;
8742  __Pyx_XDECREF(__pyx_t_1);
8743  __Pyx_AddTraceback("mprans.MeshSmoothing.getCornerNodesTriangle", __pyx_clineno, __pyx_lineno, __pyx_filename);
8744  __pyx_r = NULL;
8745  __pyx_L0:;
8746  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray, 1);
8747  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeStarArray, 1);
8748  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeStarOffsets, 1);
8749  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeMaterialTypes, 1);
8750  __Pyx_XGIVEREF(__pyx_r);
8751  __Pyx_RefNannyFinishContext();
8752  return __pyx_r;
8753 }
8754 
8755 /* "mprans/MeshSmoothing.pyx":559
8756  * nNodes=nNodes)
8757  *
8758  * def getNonOwnedNodeValues(args_, # <<<<<<<<<<<<<<
8759  * int nNodes_owned,
8760  * int nNodes_global,
8761  */
8762 
8763 /* Python wrapper */
8764 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_53getNonOwnedNodeValues(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8765 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_53getNonOwnedNodeValues = {"getNonOwnedNodeValues", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_53getNonOwnedNodeValues, METH_VARARGS|METH_KEYWORDS, 0};
8766 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_53getNonOwnedNodeValues(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8767  PyObject *__pyx_v_args_ = 0;
8768  int __pyx_v_nNodes_owned;
8769  int __pyx_v_nNodes_global;
8770  __Pyx_memviewslice __pyx_v_nodeNumbering_subdomain2global = { 0, 0, { 0 }, { 0 }, { 0 } };
8771  __Pyx_memviewslice __pyx_v_nodeOffsets_subdomain_owned = { 0, 0, { 0 }, { 0 }, { 0 } };
8772  PyObject *__pyx_r = 0;
8773  __Pyx_RefNannyDeclarations
8774  __Pyx_RefNannySetupContext("getNonOwnedNodeValues (wrapper)", 0);
8775  {
8776  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_args,&__pyx_n_s_nNodes_owned,&__pyx_n_s_nNodes_global,&__pyx_n_s_nodeNumbering_subdomain2global,&__pyx_n_s_nodeOffsets_subdomain_owned,0};
8777  PyObject* values[5] = {0,0,0,0,0};
8778  if (unlikely(__pyx_kwds)) {
8779  Py_ssize_t kw_args;
8780  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8781  switch (pos_args) {
8782  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8783  CYTHON_FALLTHROUGH;
8784  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8785  CYTHON_FALLTHROUGH;
8786  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8787  CYTHON_FALLTHROUGH;
8788  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8789  CYTHON_FALLTHROUGH;
8790  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8791  CYTHON_FALLTHROUGH;
8792  case 0: break;
8793  default: goto __pyx_L5_argtuple_error;
8794  }
8795  kw_args = PyDict_Size(__pyx_kwds);
8796  switch (pos_args) {
8797  case 0:
8798  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_args)) != 0)) kw_args--;
8799  else goto __pyx_L5_argtuple_error;
8800  CYTHON_FALLTHROUGH;
8801  case 1:
8802  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nNodes_owned)) != 0)) kw_args--;
8803  else {
8804  __Pyx_RaiseArgtupleInvalid("getNonOwnedNodeValues", 1, 5, 5, 1); __PYX_ERR(0, 559, __pyx_L3_error)
8805  }
8806  CYTHON_FALLTHROUGH;
8807  case 2:
8808  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nNodes_global)) != 0)) kw_args--;
8809  else {
8810  __Pyx_RaiseArgtupleInvalid("getNonOwnedNodeValues", 1, 5, 5, 2); __PYX_ERR(0, 559, __pyx_L3_error)
8811  }
8812  CYTHON_FALLTHROUGH;
8813  case 3:
8814  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeNumbering_subdomain2global)) != 0)) kw_args--;
8815  else {
8816  __Pyx_RaiseArgtupleInvalid("getNonOwnedNodeValues", 1, 5, 5, 3); __PYX_ERR(0, 559, __pyx_L3_error)
8817  }
8818  CYTHON_FALLTHROUGH;
8819  case 4:
8820  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeOffsets_subdomain_owned)) != 0)) kw_args--;
8821  else {
8822  __Pyx_RaiseArgtupleInvalid("getNonOwnedNodeValues", 1, 5, 5, 4); __PYX_ERR(0, 559, __pyx_L3_error)
8823  }
8824  }
8825  if (unlikely(kw_args > 0)) {
8826  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getNonOwnedNodeValues") < 0)) __PYX_ERR(0, 559, __pyx_L3_error)
8827  }
8828  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
8829  goto __pyx_L5_argtuple_error;
8830  } else {
8831  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8832  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8833  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8834  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8835  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8836  }
8837  __pyx_v_args_ = values[0];
8838  __pyx_v_nNodes_owned = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_nNodes_owned == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 560, __pyx_L3_error)
8839  __pyx_v_nNodes_global = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_nNodes_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 561, __pyx_L3_error)
8840  __pyx_v_nodeNumbering_subdomain2global = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeNumbering_subdomain2global.memview)) __PYX_ERR(0, 562, __pyx_L3_error)
8841  __pyx_v_nodeOffsets_subdomain_owned = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeOffsets_subdomain_owned.memview)) __PYX_ERR(0, 563, __pyx_L3_error)
8842  }
8843  goto __pyx_L4_argument_unpacking_done;
8844  __pyx_L5_argtuple_error:;
8845  __Pyx_RaiseArgtupleInvalid("getNonOwnedNodeValues", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 559, __pyx_L3_error)
8846  __pyx_L3_error:;
8847  __Pyx_AddTraceback("mprans.MeshSmoothing.getNonOwnedNodeValues", __pyx_clineno, __pyx_lineno, __pyx_filename);
8848  __Pyx_RefNannyFinishContext();
8849  return NULL;
8850  __pyx_L4_argument_unpacking_done:;
8851  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_52getNonOwnedNodeValues(__pyx_self, __pyx_v_args_, __pyx_v_nNodes_owned, __pyx_v_nNodes_global, __pyx_v_nodeNumbering_subdomain2global, __pyx_v_nodeOffsets_subdomain_owned);
8852 
8853  /* function exit code */
8854  __Pyx_RefNannyFinishContext();
8855  return __pyx_r;
8856 }
8857 static PyObject *__pyx_gb_6mprans_13MeshSmoothing_21getNonOwnedNodeValues_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
8858 
8859 /* "mprans/MeshSmoothing.pyx":625
8860  * comm.Gatherv(my_size,
8861  * [counts_in,
8862  * tuple(1 for i in range(comm_size)), # <<<<<<<<<<<<<<
8863  * tuple(i for i in range(comm_size)),
8864  * MPI.INT],
8865  */
8866 
8867 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_21getNonOwnedNodeValues_genexpr(PyObject *__pyx_self) {
8868  struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr *__pyx_cur_scope;
8869  PyObject *__pyx_r = NULL;
8870  __Pyx_RefNannyDeclarations
8871  __Pyx_RefNannySetupContext("genexpr", 0);
8872  __pyx_cur_scope = (struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr *)__pyx_tp_new_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr(__pyx_ptype_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr, __pyx_empty_tuple, NULL);
8873  if (unlikely(!__pyx_cur_scope)) {
8874  __pyx_cur_scope = ((struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr *)Py_None);
8875  __Pyx_INCREF(Py_None);
8876  __PYX_ERR(0, 625, __pyx_L1_error)
8877  } else {
8878  __Pyx_GOTREF(__pyx_cur_scope);
8879  }
8880  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues *) __pyx_self;
8881  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
8882  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
8883  {
8884  __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6mprans_13MeshSmoothing_21getNonOwnedNodeValues_2generator, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_getNonOwnedNodeValues_locals_gen, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!gen)) __PYX_ERR(0, 625, __pyx_L1_error)
8885  __Pyx_DECREF(__pyx_cur_scope);
8886  __Pyx_RefNannyFinishContext();
8887  return (PyObject *) gen;
8888  }
8889 
8890  /* function exit code */
8891  __pyx_L1_error:;
8892  __Pyx_AddTraceback("mprans.MeshSmoothing.getNonOwnedNodeValues.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
8893  __pyx_r = NULL;
8894  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
8895  __Pyx_XGIVEREF(__pyx_r);
8896  __Pyx_RefNannyFinishContext();
8897  return __pyx_r;
8898 }
8899 
8900 static PyObject *__pyx_gb_6mprans_13MeshSmoothing_21getNonOwnedNodeValues_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
8901 {
8902  struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr *)__pyx_generator->closure);
8903  PyObject *__pyx_r = NULL;
8904  int __pyx_t_1;
8905  int __pyx_t_2;
8906  int __pyx_t_3;
8907  __Pyx_RefNannyDeclarations
8908  __Pyx_RefNannySetupContext("genexpr", 0);
8909  switch (__pyx_generator->resume_label) {
8910  case 0: goto __pyx_L3_first_run;
8911  case 1: goto __pyx_L6_resume_from_yield;
8912  default: /* CPython raises the right error here */
8913  __Pyx_RefNannyFinishContext();
8914  return NULL;
8915  }
8916  __pyx_L3_first_run:;
8917  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 625, __pyx_L1_error)
8918  __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_comm_size;
8919  __pyx_t_2 = __pyx_t_1;
8920  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
8921  __pyx_cur_scope->__pyx_v_i = __pyx_t_3;
8922  __Pyx_INCREF(__pyx_int_1);
8923  __pyx_r = __pyx_int_1;
8924  __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
8925  __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
8926  __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
8927  __Pyx_XGIVEREF(__pyx_r);
8928  __Pyx_RefNannyFinishContext();
8929  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
8930  /* return from generator, yielding value */
8931  __pyx_generator->resume_label = 1;
8932  return __pyx_r;
8933  __pyx_L6_resume_from_yield:;
8934  __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
8935  __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
8936  __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
8937  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 625, __pyx_L1_error)
8938  }
8939  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
8940 
8941  /* function exit code */
8942  PyErr_SetNone(PyExc_StopIteration);
8943  goto __pyx_L0;
8944  __pyx_L1_error:;
8945  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
8946  __pyx_L0:;
8947  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
8948  #if !CYTHON_USE_EXC_INFO_STACK
8949  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
8950  #endif
8951  __pyx_generator->resume_label = -1;
8952  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
8953  __Pyx_RefNannyFinishContext();
8954  return __pyx_r;
8955 }
8956 static PyObject *__pyx_gb_6mprans_13MeshSmoothing_21getNonOwnedNodeValues_5generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
8957 
8958 /* "mprans/MeshSmoothing.pyx":626
8959  * [counts_in,
8960  * tuple(1 for i in range(comm_size)),
8961  * tuple(i for i in range(comm_size)), # <<<<<<<<<<<<<<
8962  * MPI.INT],
8963  * root=rank_recv
8964  */
8965 
8966 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_21getNonOwnedNodeValues_3genexpr(PyObject *__pyx_self) {
8967  struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr *__pyx_cur_scope;
8968  PyObject *__pyx_r = NULL;
8969  __Pyx_RefNannyDeclarations
8970  __Pyx_RefNannySetupContext("genexpr", 0);
8971  __pyx_cur_scope = (struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr *)__pyx_tp_new_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr(__pyx_ptype_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr, __pyx_empty_tuple, NULL);
8972  if (unlikely(!__pyx_cur_scope)) {
8973  __pyx_cur_scope = ((struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr *)Py_None);
8974  __Pyx_INCREF(Py_None);
8975  __PYX_ERR(0, 626, __pyx_L1_error)
8976  } else {
8977  __Pyx_GOTREF(__pyx_cur_scope);
8978  }
8979  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues *) __pyx_self;
8980  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
8981  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
8982  {
8983  __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6mprans_13MeshSmoothing_21getNonOwnedNodeValues_5generator1, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_getNonOwnedNodeValues_locals_gen, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!gen)) __PYX_ERR(0, 626, __pyx_L1_error)
8984  __Pyx_DECREF(__pyx_cur_scope);
8985  __Pyx_RefNannyFinishContext();
8986  return (PyObject *) gen;
8987  }
8988 
8989  /* function exit code */
8990  __pyx_L1_error:;
8991  __Pyx_AddTraceback("mprans.MeshSmoothing.getNonOwnedNodeValues.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
8992  __pyx_r = NULL;
8993  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
8994  __Pyx_XGIVEREF(__pyx_r);
8995  __Pyx_RefNannyFinishContext();
8996  return __pyx_r;
8997 }
8998 
8999 static PyObject *__pyx_gb_6mprans_13MeshSmoothing_21getNonOwnedNodeValues_5generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
9000 {
9001  struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr *__pyx_cur_scope = ((struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr *)__pyx_generator->closure);
9002  PyObject *__pyx_r = NULL;
9003  int __pyx_t_1;
9004  int __pyx_t_2;
9005  int __pyx_t_3;
9006  PyObject *__pyx_t_4 = NULL;
9007  __Pyx_RefNannyDeclarations
9008  __Pyx_RefNannySetupContext("genexpr", 0);
9009  switch (__pyx_generator->resume_label) {
9010  case 0: goto __pyx_L3_first_run;
9011  case 1: goto __pyx_L6_resume_from_yield;
9012  default: /* CPython raises the right error here */
9013  __Pyx_RefNannyFinishContext();
9014  return NULL;
9015  }
9016  __pyx_L3_first_run:;
9017  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 626, __pyx_L1_error)
9018  __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_comm_size;
9019  __pyx_t_2 = __pyx_t_1;
9020  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
9021  __pyx_cur_scope->__pyx_v_i = __pyx_t_3;
9022  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 626, __pyx_L1_error)
9023  __Pyx_GOTREF(__pyx_t_4);
9024  __pyx_r = __pyx_t_4;
9025  __pyx_t_4 = 0;
9026  __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
9027  __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
9028  __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
9029  __Pyx_XGIVEREF(__pyx_r);
9030  __Pyx_RefNannyFinishContext();
9031  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
9032  /* return from generator, yielding value */
9033  __pyx_generator->resume_label = 1;
9034  return __pyx_r;
9035  __pyx_L6_resume_from_yield:;
9036  __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
9037  __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
9038  __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
9039  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 626, __pyx_L1_error)
9040  }
9041  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
9042 
9043  /* function exit code */
9044  PyErr_SetNone(PyExc_StopIteration);
9045  goto __pyx_L0;
9046  __pyx_L1_error:;
9047  __Pyx_XDECREF(__pyx_t_4);
9048  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
9049  __pyx_L0:;
9050  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
9051  #if !CYTHON_USE_EXC_INFO_STACK
9052  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
9053  #endif
9054  __pyx_generator->resume_label = -1;
9055  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
9056  __Pyx_RefNannyFinishContext();
9057  return __pyx_r;
9058 }
9059 
9060 /* "mprans/MeshSmoothing.pyx":559
9061  * nNodes=nNodes)
9062  *
9063  * def getNonOwnedNodeValues(args_, # <<<<<<<<<<<<<<
9064  * int nNodes_owned,
9065  * int nNodes_global,
9066  */
9067 
9068 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_52getNonOwnedNodeValues(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_args_, int __pyx_v_nNodes_owned, int __pyx_v_nNodes_global, __Pyx_memviewslice __pyx_v_nodeNumbering_subdomain2global, __Pyx_memviewslice __pyx_v_nodeOffsets_subdomain_owned) {
9069  struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues *__pyx_cur_scope;
9070  PyObject *__pyx_v_Comm = NULL;
9071  PyObject *__pyx_v_comm = 0;
9072  int __pyx_v_my_rank;
9073  PyObject *__pyx_v_arg_2rank = 0;
9074  PyObject *__pyx_v_nodes_2rank = 0;
9075  __Pyx_memviewslice __pyx_v_result = { 0, 0, { 0 }, { 0 }, { 0 } };
9076  __Pyx_memviewslice __pyx_v_counts_in = { 0, 0, { 0 }, { 0 }, { 0 } };
9077  __Pyx_memviewslice __pyx_v_displacements_in = { 0, 0, { 0 }, { 0 }, { 0 } };
9078  __Pyx_memviewslice __pyx_v_counts_out = { 0, 0, { 0 }, { 0 }, { 0 } };
9079  __Pyx_memviewslice __pyx_v_displacements_out = { 0, 0, { 0 }, { 0 }, { 0 } };
9080  __Pyx_memviewslice __pyx_v_arg_shape = { 0, 0, { 0 }, { 0 }, { 0 } };
9081  __Pyx_memviewslice __pyx_v_arg_shape_copy = { 0, 0, { 0 }, { 0 }, { 0 } };
9082  int __pyx_v_arg_shape_len;
9083  int __pyx_v_shape_factor;
9084  int __pyx_v_disp;
9085  int __pyx_v_rank;
9086  int __pyx_v_rank_recv;
9087  int __pyx_v_ii;
9088  int __pyx_v_ir;
9089  int __pyx_v_iN;
9090  int __pyx_v_node_new_rank;
9091  int __pyx_v_new_rank;
9092  int __pyx_v_sumtot;
9093  __Pyx_memviewslice __pyx_v_nodes_2rank_values = { 0, 0, { 0 }, { 0 }, { 0 } };
9094  __Pyx_memviewslice __pyx_v_nodes_2doArray = { 0, 0, { 0 }, { 0 }, { 0 } };
9095  long __pyx_v_i;
9096  int __pyx_v_node;
9097  Py_ssize_t __pyx_v_nodes_2rank_len;
9098  PyObject *__pyx_v_array_size = NULL;
9099  PyObject *__pyx_v_my_size = NULL;
9100  PyObject *__pyx_v_arg_2rank_values = NULL;
9101  PyObject *__pyx_v_arg_2doArray = NULL;
9102  PyObject *__pyx_v_datatype = NULL;
9103  PyObject *__pyx_r = NULL;
9104  __Pyx_RefNannyDeclarations
9105  PyObject *__pyx_t_1 = NULL;
9106  PyObject *__pyx_t_2 = NULL;
9107  PyObject *__pyx_t_3 = NULL;
9108  PyObject *__pyx_t_4 = NULL;
9109  PyObject *__pyx_t_5 = NULL;
9110  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
9111  int __pyx_t_7;
9112  size_t __pyx_t_8;
9113  int __pyx_t_9;
9114  int __pyx_t_10;
9115  long __pyx_t_11;
9116  Py_ssize_t __pyx_t_12;
9117  int __pyx_t_13;
9118  Py_ssize_t __pyx_t_14;
9119  Py_ssize_t __pyx_t_15;
9120  int __pyx_t_16;
9121  PyObject *__pyx_t_17 = NULL;
9122  Py_ssize_t __pyx_t_18;
9123  Py_ssize_t __pyx_t_19;
9124  Py_ssize_t __pyx_t_20;
9125  Py_ssize_t __pyx_t_21;
9126  int __pyx_t_22;
9127  int __pyx_t_23;
9128  Py_ssize_t __pyx_t_24;
9129  Py_ssize_t __pyx_t_25;
9130  Py_ssize_t __pyx_t_26;
9131  Py_ssize_t __pyx_t_27;
9132  PyObject *__pyx_t_28 = NULL;
9133  Py_ssize_t __pyx_t_29;
9134  Py_ssize_t __pyx_t_30;
9135  Py_ssize_t __pyx_t_31;
9136  Py_ssize_t __pyx_t_32;
9137  Py_ssize_t __pyx_t_33;
9138  Py_ssize_t __pyx_t_34;
9139  int __pyx_t_35;
9140  int __pyx_t_36;
9141  int __pyx_t_37;
9142  Py_ssize_t __pyx_t_38;
9143  Py_ssize_t __pyx_t_39;
9144  Py_ssize_t __pyx_t_40;
9145  Py_ssize_t __pyx_t_41;
9146  __Pyx_RefNannySetupContext("getNonOwnedNodeValues", 0);
9147  __pyx_cur_scope = (struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues *)__pyx_tp_new_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues(__pyx_ptype_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues, __pyx_empty_tuple, NULL);
9148  if (unlikely(!__pyx_cur_scope)) {
9149  __pyx_cur_scope = ((struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues *)Py_None);
9150  __Pyx_INCREF(Py_None);
9151  __PYX_ERR(0, 559, __pyx_L1_error)
9152  } else {
9153  __Pyx_GOTREF(__pyx_cur_scope);
9154  }
9155 
9156  /* "mprans/MeshSmoothing.pyx":564
9157  * int[:] nodeNumbering_subdomain2global,
9158  * int[:] nodeOffsets_subdomain_owned):
9159  * nodeNumbering_subdomain2global = np.array(nodeNumbering_subdomain2global, dtype=np.int32) # <<<<<<<<<<<<<<
9160  * nodeOffsets_subdomain_owned = np.array(nodeOffsets_subdomain_owned, dtype=np.int32)
9161  * from proteus import Comm
9162  */
9163  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 564, __pyx_L1_error)
9164  __Pyx_GOTREF(__pyx_t_1);
9165  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 564, __pyx_L1_error)
9166  __Pyx_GOTREF(__pyx_t_2);
9167  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9168  __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_nodeNumbering_subdomain2global, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 564, __pyx_L1_error)
9169  __Pyx_GOTREF(__pyx_t_1);
9170  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 564, __pyx_L1_error)
9171  __Pyx_GOTREF(__pyx_t_3);
9172  __Pyx_GIVEREF(__pyx_t_1);
9173  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
9174  __pyx_t_1 = 0;
9175  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 564, __pyx_L1_error)
9176  __Pyx_GOTREF(__pyx_t_1);
9177  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 564, __pyx_L1_error)
9178  __Pyx_GOTREF(__pyx_t_4);
9179  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 564, __pyx_L1_error)
9180  __Pyx_GOTREF(__pyx_t_5);
9181  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9182  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 564, __pyx_L1_error)
9183  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9184  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 564, __pyx_L1_error)
9185  __Pyx_GOTREF(__pyx_t_5);
9186  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9187  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9188  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9189  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 564, __pyx_L1_error)
9190  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9191  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeNumbering_subdomain2global, 1);
9192  __pyx_v_nodeNumbering_subdomain2global = __pyx_t_6;
9193  __pyx_t_6.memview = NULL;
9194  __pyx_t_6.data = NULL;
9195 
9196  /* "mprans/MeshSmoothing.pyx":565
9197  * int[:] nodeOffsets_subdomain_owned):
9198  * nodeNumbering_subdomain2global = np.array(nodeNumbering_subdomain2global, dtype=np.int32)
9199  * nodeOffsets_subdomain_owned = np.array(nodeOffsets_subdomain_owned, dtype=np.int32) # <<<<<<<<<<<<<<
9200  * from proteus import Comm
9201  * cdef object comm = Comm.get().comm.tompi4py()
9202  */
9203  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 565, __pyx_L1_error)
9204  __Pyx_GOTREF(__pyx_t_5);
9205  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_array); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 565, __pyx_L1_error)
9206  __Pyx_GOTREF(__pyx_t_1);
9207  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9208  __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_nodeOffsets_subdomain_owned, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 565, __pyx_L1_error)
9209  __Pyx_GOTREF(__pyx_t_5);
9210  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 565, __pyx_L1_error)
9211  __Pyx_GOTREF(__pyx_t_3);
9212  __Pyx_GIVEREF(__pyx_t_5);
9213  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
9214  __pyx_t_5 = 0;
9215  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 565, __pyx_L1_error)
9216  __Pyx_GOTREF(__pyx_t_5);
9217  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 565, __pyx_L1_error)
9218  __Pyx_GOTREF(__pyx_t_2);
9219  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_int32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 565, __pyx_L1_error)
9220  __Pyx_GOTREF(__pyx_t_4);
9221  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9222  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 565, __pyx_L1_error)
9223  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9224  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 565, __pyx_L1_error)
9225  __Pyx_GOTREF(__pyx_t_4);
9226  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9227  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9228  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9229  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 565, __pyx_L1_error)
9230  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9231  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeOffsets_subdomain_owned, 1);
9232  __pyx_v_nodeOffsets_subdomain_owned = __pyx_t_6;
9233  __pyx_t_6.memview = NULL;
9234  __pyx_t_6.data = NULL;
9235 
9236  /* "mprans/MeshSmoothing.pyx":566
9237  * nodeNumbering_subdomain2global = np.array(nodeNumbering_subdomain2global, dtype=np.int32)
9238  * nodeOffsets_subdomain_owned = np.array(nodeOffsets_subdomain_owned, dtype=np.int32)
9239  * from proteus import Comm # <<<<<<<<<<<<<<
9240  * cdef object comm = Comm.get().comm.tompi4py()
9241  * cdef int comm_size = comm.size
9242  */
9243  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 566, __pyx_L1_error)
9244  __Pyx_GOTREF(__pyx_t_4);
9245  __Pyx_INCREF(__pyx_n_s_Comm);
9246  __Pyx_GIVEREF(__pyx_n_s_Comm);
9247  PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_Comm);
9248  __pyx_t_5 = __Pyx_Import(__pyx_n_s_proteus, __pyx_t_4, -1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 566, __pyx_L1_error)
9249  __Pyx_GOTREF(__pyx_t_5);
9250  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9251  __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_5, __pyx_n_s_Comm); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 566, __pyx_L1_error)
9252  __Pyx_GOTREF(__pyx_t_4);
9253  __Pyx_INCREF(__pyx_t_4);
9254  __pyx_v_Comm = __pyx_t_4;
9255  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9256  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9257 
9258  /* "mprans/MeshSmoothing.pyx":567
9259  * nodeOffsets_subdomain_owned = np.array(nodeOffsets_subdomain_owned, dtype=np.int32)
9260  * from proteus import Comm
9261  * cdef object comm = Comm.get().comm.tompi4py() # <<<<<<<<<<<<<<
9262  * cdef int comm_size = comm.size
9263  * cdef int my_rank = comm.rank
9264  */
9265  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_Comm, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 567, __pyx_L1_error)
9266  __Pyx_GOTREF(__pyx_t_3);
9267  __pyx_t_1 = NULL;
9268  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
9269  __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
9270  if (likely(__pyx_t_1)) {
9271  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
9272  __Pyx_INCREF(__pyx_t_1);
9273  __Pyx_INCREF(function);
9274  __Pyx_DECREF_SET(__pyx_t_3, function);
9275  }
9276  }
9277  __pyx_t_4 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
9278  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
9279  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 567, __pyx_L1_error)
9280  __Pyx_GOTREF(__pyx_t_4);
9281  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9282  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_comm); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 567, __pyx_L1_error)
9283  __Pyx_GOTREF(__pyx_t_3);
9284  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9285  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_tompi4py); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 567, __pyx_L1_error)
9286  __Pyx_GOTREF(__pyx_t_4);
9287  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9288  __pyx_t_3 = NULL;
9289  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
9290  __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
9291  if (likely(__pyx_t_3)) {
9292  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
9293  __Pyx_INCREF(__pyx_t_3);
9294  __Pyx_INCREF(function);
9295  __Pyx_DECREF_SET(__pyx_t_4, function);
9296  }
9297  }
9298  __pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
9299  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
9300  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 567, __pyx_L1_error)
9301  __Pyx_GOTREF(__pyx_t_5);
9302  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9303  __pyx_v_comm = __pyx_t_5;
9304  __pyx_t_5 = 0;
9305 
9306  /* "mprans/MeshSmoothing.pyx":568
9307  * from proteus import Comm
9308  * cdef object comm = Comm.get().comm.tompi4py()
9309  * cdef int comm_size = comm.size # <<<<<<<<<<<<<<
9310  * cdef int my_rank = comm.rank
9311  * cdef dict arg_2rank = {}
9312  */
9313  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_comm, __pyx_n_s_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 568, __pyx_L1_error)
9314  __Pyx_GOTREF(__pyx_t_5);
9315  __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 568, __pyx_L1_error)
9316  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9317  __pyx_cur_scope->__pyx_v_comm_size = __pyx_t_7;
9318 
9319  /* "mprans/MeshSmoothing.pyx":569
9320  * cdef object comm = Comm.get().comm.tompi4py()
9321  * cdef int comm_size = comm.size
9322  * cdef int my_rank = comm.rank # <<<<<<<<<<<<<<
9323  * cdef dict arg_2rank = {}
9324  * cdef dict nodes_2rank = {}
9325  */
9326  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_comm, __pyx_n_s_rank); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 569, __pyx_L1_error)
9327  __Pyx_GOTREF(__pyx_t_5);
9328  __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 569, __pyx_L1_error)
9329  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9330  __pyx_v_my_rank = __pyx_t_7;
9331 
9332  /* "mprans/MeshSmoothing.pyx":570
9333  * cdef int comm_size = comm.size
9334  * cdef int my_rank = comm.rank
9335  * cdef dict arg_2rank = {} # <<<<<<<<<<<<<<
9336  * cdef dict nodes_2rank = {}
9337  * cdef int[:] result
9338  */
9339  __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 570, __pyx_L1_error)
9340  __Pyx_GOTREF(__pyx_t_5);
9341  __pyx_v_arg_2rank = ((PyObject*)__pyx_t_5);
9342  __pyx_t_5 = 0;
9343 
9344  /* "mprans/MeshSmoothing.pyx":571
9345  * cdef int my_rank = comm.rank
9346  * cdef dict arg_2rank = {}
9347  * cdef dict nodes_2rank = {} # <<<<<<<<<<<<<<
9348  * cdef int[:] result
9349  * # the counts and displacements for nodes coming in from other processors
9350  */
9351  __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 571, __pyx_L1_error)
9352  __Pyx_GOTREF(__pyx_t_5);
9353  __pyx_v_nodes_2rank = ((PyObject*)__pyx_t_5);
9354  __pyx_t_5 = 0;
9355 
9356  /* "mprans/MeshSmoothing.pyx":574
9357  * cdef int[:] result
9358  * # the counts and displacements for nodes coming in from other processors
9359  * cdef int[:] counts_in = np.zeros(comm_size, dtype=np.int32) # <<<<<<<<<<<<<<
9360  * cdef int[:] displacements_in = np.zeros(comm_size, dtype=np.int32)
9361  * # the counts and displacements args_ coming back from other processors
9362  */
9363  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 574, __pyx_L1_error)
9364  __Pyx_GOTREF(__pyx_t_5);
9365  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 574, __pyx_L1_error)
9366  __Pyx_GOTREF(__pyx_t_4);
9367  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9368  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_comm_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 574, __pyx_L1_error)
9369  __Pyx_GOTREF(__pyx_t_5);
9370  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 574, __pyx_L1_error)
9371  __Pyx_GOTREF(__pyx_t_3);
9372  __Pyx_GIVEREF(__pyx_t_5);
9373  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
9374  __pyx_t_5 = 0;
9375  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 574, __pyx_L1_error)
9376  __Pyx_GOTREF(__pyx_t_5);
9377  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 574, __pyx_L1_error)
9378  __Pyx_GOTREF(__pyx_t_1);
9379  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_int32); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 574, __pyx_L1_error)
9380  __Pyx_GOTREF(__pyx_t_2);
9381  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9382  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 574, __pyx_L1_error)
9383  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9384  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 574, __pyx_L1_error)
9385  __Pyx_GOTREF(__pyx_t_2);
9386  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9387  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9388  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9389  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 574, __pyx_L1_error)
9390  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9391  __pyx_v_counts_in = __pyx_t_6;
9392  __pyx_t_6.memview = NULL;
9393  __pyx_t_6.data = NULL;
9394 
9395  /* "mprans/MeshSmoothing.pyx":575
9396  * # the counts and displacements for nodes coming in from other processors
9397  * cdef int[:] counts_in = np.zeros(comm_size, dtype=np.int32)
9398  * cdef int[:] displacements_in = np.zeros(comm_size, dtype=np.int32) # <<<<<<<<<<<<<<
9399  * # the counts and displacements args_ coming back from other processors
9400  * cdef int[:] counts_out = np.zeros(comm_size, dtype=np.int32)
9401  */
9402  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 575, __pyx_L1_error)
9403  __Pyx_GOTREF(__pyx_t_2);
9404  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 575, __pyx_L1_error)
9405  __Pyx_GOTREF(__pyx_t_5);
9406  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9407  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_comm_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 575, __pyx_L1_error)
9408  __Pyx_GOTREF(__pyx_t_2);
9409  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 575, __pyx_L1_error)
9410  __Pyx_GOTREF(__pyx_t_3);
9411  __Pyx_GIVEREF(__pyx_t_2);
9412  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
9413  __pyx_t_2 = 0;
9414  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 575, __pyx_L1_error)
9415  __Pyx_GOTREF(__pyx_t_2);
9416  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 575, __pyx_L1_error)
9417  __Pyx_GOTREF(__pyx_t_4);
9418  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 575, __pyx_L1_error)
9419  __Pyx_GOTREF(__pyx_t_1);
9420  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9421  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 575, __pyx_L1_error)
9422  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9423  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 575, __pyx_L1_error)
9424  __Pyx_GOTREF(__pyx_t_1);
9425  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9426  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9427  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9428  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 575, __pyx_L1_error)
9429  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9430  __pyx_v_displacements_in = __pyx_t_6;
9431  __pyx_t_6.memview = NULL;
9432  __pyx_t_6.data = NULL;
9433 
9434  /* "mprans/MeshSmoothing.pyx":577
9435  * cdef int[:] displacements_in = np.zeros(comm_size, dtype=np.int32)
9436  * # the counts and displacements args_ coming back from other processors
9437  * cdef int[:] counts_out = np.zeros(comm_size, dtype=np.int32) # <<<<<<<<<<<<<<
9438  * cdef int[:] displacements_out = np.zeros(comm_size, dtype=np.int32)
9439  * # shape of the argument
9440  */
9441  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 577, __pyx_L1_error)
9442  __Pyx_GOTREF(__pyx_t_1);
9443  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 577, __pyx_L1_error)
9444  __Pyx_GOTREF(__pyx_t_2);
9445  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9446  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_comm_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 577, __pyx_L1_error)
9447  __Pyx_GOTREF(__pyx_t_1);
9448  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 577, __pyx_L1_error)
9449  __Pyx_GOTREF(__pyx_t_3);
9450  __Pyx_GIVEREF(__pyx_t_1);
9451  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
9452  __pyx_t_1 = 0;
9453  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 577, __pyx_L1_error)
9454  __Pyx_GOTREF(__pyx_t_1);
9455  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 577, __pyx_L1_error)
9456  __Pyx_GOTREF(__pyx_t_5);
9457  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_int32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 577, __pyx_L1_error)
9458  __Pyx_GOTREF(__pyx_t_4);
9459  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9460  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 577, __pyx_L1_error)
9461  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9462  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 577, __pyx_L1_error)
9463  __Pyx_GOTREF(__pyx_t_4);
9464  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9465  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9466  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9467  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 577, __pyx_L1_error)
9468  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9469  __pyx_v_counts_out = __pyx_t_6;
9470  __pyx_t_6.memview = NULL;
9471  __pyx_t_6.data = NULL;
9472 
9473  /* "mprans/MeshSmoothing.pyx":578
9474  * # the counts and displacements args_ coming back from other processors
9475  * cdef int[:] counts_out = np.zeros(comm_size, dtype=np.int32)
9476  * cdef int[:] displacements_out = np.zeros(comm_size, dtype=np.int32) # <<<<<<<<<<<<<<
9477  * # shape of the argument
9478  * cdef int[:] arg_shape = np.array(args_.shape, dtype=np.int32)
9479  */
9480  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 578, __pyx_L1_error)
9481  __Pyx_GOTREF(__pyx_t_4);
9482  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 578, __pyx_L1_error)
9483  __Pyx_GOTREF(__pyx_t_1);
9484  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9485  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_comm_size); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 578, __pyx_L1_error)
9486  __Pyx_GOTREF(__pyx_t_4);
9487  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 578, __pyx_L1_error)
9488  __Pyx_GOTREF(__pyx_t_3);
9489  __Pyx_GIVEREF(__pyx_t_4);
9490  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
9491  __pyx_t_4 = 0;
9492  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 578, __pyx_L1_error)
9493  __Pyx_GOTREF(__pyx_t_4);
9494  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 578, __pyx_L1_error)
9495  __Pyx_GOTREF(__pyx_t_2);
9496  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_int32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 578, __pyx_L1_error)
9497  __Pyx_GOTREF(__pyx_t_5);
9498  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9499  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 578, __pyx_L1_error)
9500  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9501  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 578, __pyx_L1_error)
9502  __Pyx_GOTREF(__pyx_t_5);
9503  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9504  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9505  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9506  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 578, __pyx_L1_error)
9507  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9508  __pyx_v_displacements_out = __pyx_t_6;
9509  __pyx_t_6.memview = NULL;
9510  __pyx_t_6.data = NULL;
9511 
9512  /* "mprans/MeshSmoothing.pyx":580
9513  * cdef int[:] displacements_out = np.zeros(comm_size, dtype=np.int32)
9514  * # shape of the argument
9515  * cdef int[:] arg_shape = np.array(args_.shape, dtype=np.int32) # <<<<<<<<<<<<<<
9516  * cdef int[:] arg_shape_copy = np.array(args_.shape, dtype=np.int32)
9517  * cdef int arg_shape_len = len(arg_shape)
9518  */
9519  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 580, __pyx_L1_error)
9520  __Pyx_GOTREF(__pyx_t_5);
9521  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_array); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 580, __pyx_L1_error)
9522  __Pyx_GOTREF(__pyx_t_4);
9523  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9524  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_args_, __pyx_n_s_shape); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 580, __pyx_L1_error)
9525  __Pyx_GOTREF(__pyx_t_5);
9526  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 580, __pyx_L1_error)
9527  __Pyx_GOTREF(__pyx_t_3);
9528  __Pyx_GIVEREF(__pyx_t_5);
9529  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
9530  __pyx_t_5 = 0;
9531  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 580, __pyx_L1_error)
9532  __Pyx_GOTREF(__pyx_t_5);
9533  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 580, __pyx_L1_error)
9534  __Pyx_GOTREF(__pyx_t_1);
9535  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_int32); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 580, __pyx_L1_error)
9536  __Pyx_GOTREF(__pyx_t_2);
9537  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9538  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 580, __pyx_L1_error)
9539  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9540  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 580, __pyx_L1_error)
9541  __Pyx_GOTREF(__pyx_t_2);
9542  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9543  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9544  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9545  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 580, __pyx_L1_error)
9546  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9547  __pyx_v_arg_shape = __pyx_t_6;
9548  __pyx_t_6.memview = NULL;
9549  __pyx_t_6.data = NULL;
9550 
9551  /* "mprans/MeshSmoothing.pyx":581
9552  * # shape of the argument
9553  * cdef int[:] arg_shape = np.array(args_.shape, dtype=np.int32)
9554  * cdef int[:] arg_shape_copy = np.array(args_.shape, dtype=np.int32) # <<<<<<<<<<<<<<
9555  * cdef int arg_shape_len = len(arg_shape)
9556  * cdef int shape_factor = 1
9557  */
9558  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 581, __pyx_L1_error)
9559  __Pyx_GOTREF(__pyx_t_2);
9560  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 581, __pyx_L1_error)
9561  __Pyx_GOTREF(__pyx_t_5);
9562  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9563  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_args_, __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 581, __pyx_L1_error)
9564  __Pyx_GOTREF(__pyx_t_2);
9565  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 581, __pyx_L1_error)
9566  __Pyx_GOTREF(__pyx_t_3);
9567  __Pyx_GIVEREF(__pyx_t_2);
9568  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
9569  __pyx_t_2 = 0;
9570  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 581, __pyx_L1_error)
9571  __Pyx_GOTREF(__pyx_t_2);
9572  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 581, __pyx_L1_error)
9573  __Pyx_GOTREF(__pyx_t_4);
9574  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 581, __pyx_L1_error)
9575  __Pyx_GOTREF(__pyx_t_1);
9576  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9577  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 581, __pyx_L1_error)
9578  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9579  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 581, __pyx_L1_error)
9580  __Pyx_GOTREF(__pyx_t_1);
9581  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9582  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9583  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9584  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 581, __pyx_L1_error)
9585  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9586  __pyx_v_arg_shape_copy = __pyx_t_6;
9587  __pyx_t_6.memview = NULL;
9588  __pyx_t_6.data = NULL;
9589 
9590  /* "mprans/MeshSmoothing.pyx":582
9591  * cdef int[:] arg_shape = np.array(args_.shape, dtype=np.int32)
9592  * cdef int[:] arg_shape_copy = np.array(args_.shape, dtype=np.int32)
9593  * cdef int arg_shape_len = len(arg_shape) # <<<<<<<<<<<<<<
9594  * cdef int shape_factor = 1
9595  * cdef int disp = 0
9596  */
9597  __pyx_t_8 = __Pyx_MemoryView_Len(__pyx_v_arg_shape);
9598  __pyx_v_arg_shape_len = __pyx_t_8;
9599 
9600  /* "mprans/MeshSmoothing.pyx":583
9601  * cdef int[:] arg_shape_copy = np.array(args_.shape, dtype=np.int32)
9602  * cdef int arg_shape_len = len(arg_shape)
9603  * cdef int shape_factor = 1 # <<<<<<<<<<<<<<
9604  * cdef int disp = 0
9605  * cdef int rank, rank_recv, ii, ir, iN, node_new_rank, new_rank
9606  */
9607  __pyx_v_shape_factor = 1;
9608 
9609  /* "mprans/MeshSmoothing.pyx":584
9610  * cdef int arg_shape_len = len(arg_shape)
9611  * cdef int shape_factor = 1
9612  * cdef int disp = 0 # <<<<<<<<<<<<<<
9613  * cdef int rank, rank_recv, ii, ir, iN, node_new_rank, new_rank
9614  * cdef int sumtot
9615  */
9616  __pyx_v_disp = 0;
9617 
9618  /* "mprans/MeshSmoothing.pyx":588
9619  * cdef int sumtot
9620  * cdef int[:] nodes_2rank_values
9621  * cdef int[:] nodes_2doArray = np.zeros(0, dtype=np.int32) # <<<<<<<<<<<<<<
9622  * if arg_shape_len > 1:
9623  * for i in range(1, arg_shape_len):
9624  */
9625  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 588, __pyx_L1_error)
9626  __Pyx_GOTREF(__pyx_t_1);
9627  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 588, __pyx_L1_error)
9628  __Pyx_GOTREF(__pyx_t_2);
9629  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9630  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 588, __pyx_L1_error)
9631  __Pyx_GOTREF(__pyx_t_1);
9632  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 588, __pyx_L1_error)
9633  __Pyx_GOTREF(__pyx_t_3);
9634  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_int32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 588, __pyx_L1_error)
9635  __Pyx_GOTREF(__pyx_t_5);
9636  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9637  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 588, __pyx_L1_error)
9638  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9639  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 588, __pyx_L1_error)
9640  __Pyx_GOTREF(__pyx_t_5);
9641  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9642  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9643  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 588, __pyx_L1_error)
9644  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9645  __pyx_v_nodes_2doArray = __pyx_t_6;
9646  __pyx_t_6.memview = NULL;
9647  __pyx_t_6.data = NULL;
9648 
9649  /* "mprans/MeshSmoothing.pyx":589
9650  * cdef int[:] nodes_2rank_values
9651  * cdef int[:] nodes_2doArray = np.zeros(0, dtype=np.int32)
9652  * if arg_shape_len > 1: # <<<<<<<<<<<<<<
9653  * for i in range(1, arg_shape_len):
9654  * shape_factor = shape_factor*arg_shape[i]
9655  */
9656  __pyx_t_9 = ((__pyx_v_arg_shape_len > 1) != 0);
9657  if (__pyx_t_9) {
9658 
9659  /* "mprans/MeshSmoothing.pyx":590
9660  * cdef int[:] nodes_2doArray = np.zeros(0, dtype=np.int32)
9661  * if arg_shape_len > 1:
9662  * for i in range(1, arg_shape_len): # <<<<<<<<<<<<<<
9663  * shape_factor = shape_factor*arg_shape[i]
9664  * if comm_size > 1:
9665  */
9666  __pyx_t_7 = __pyx_v_arg_shape_len;
9667  __pyx_t_10 = __pyx_t_7;
9668  for (__pyx_t_11 = 1; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
9669  __pyx_v_i = __pyx_t_11;
9670 
9671  /* "mprans/MeshSmoothing.pyx":591
9672  * if arg_shape_len > 1:
9673  * for i in range(1, arg_shape_len):
9674  * shape_factor = shape_factor*arg_shape[i] # <<<<<<<<<<<<<<
9675  * if comm_size > 1:
9676  * for rank in range(comm_size):
9677  */
9678  __pyx_t_12 = __pyx_v_i;
9679  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_arg_shape.shape[0];
9680  __pyx_v_shape_factor = (__pyx_v_shape_factor * (*((int *) ( /* dim=0 */ (__pyx_v_arg_shape.data + __pyx_t_12 * __pyx_v_arg_shape.strides[0]) ))));
9681  }
9682 
9683  /* "mprans/MeshSmoothing.pyx":589
9684  * cdef int[:] nodes_2rank_values
9685  * cdef int[:] nodes_2doArray = np.zeros(0, dtype=np.int32)
9686  * if arg_shape_len > 1: # <<<<<<<<<<<<<<
9687  * for i in range(1, arg_shape_len):
9688  * shape_factor = shape_factor*arg_shape[i]
9689  */
9690  }
9691 
9692  /* "mprans/MeshSmoothing.pyx":592
9693  * for i in range(1, arg_shape_len):
9694  * shape_factor = shape_factor*arg_shape[i]
9695  * if comm_size > 1: # <<<<<<<<<<<<<<
9696  * for rank in range(comm_size):
9697  * nodes_2rank[rank] = np.zeros(0, dtype=np.int32)
9698  */
9699  __pyx_t_9 = ((__pyx_cur_scope->__pyx_v_comm_size > 1) != 0);
9700  if (__pyx_t_9) {
9701 
9702  /* "mprans/MeshSmoothing.pyx":593
9703  * shape_factor = shape_factor*arg_shape[i]
9704  * if comm_size > 1:
9705  * for rank in range(comm_size): # <<<<<<<<<<<<<<
9706  * nodes_2rank[rank] = np.zeros(0, dtype=np.int32)
9707  * for node in range(nNodes_owned, nNodes_global):
9708  */
9709  __pyx_t_7 = __pyx_cur_scope->__pyx_v_comm_size;
9710  __pyx_t_10 = __pyx_t_7;
9711  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_10; __pyx_t_13+=1) {
9712  __pyx_v_rank = __pyx_t_13;
9713 
9714  /* "mprans/MeshSmoothing.pyx":594
9715  * if comm_size > 1:
9716  * for rank in range(comm_size):
9717  * nodes_2rank[rank] = np.zeros(0, dtype=np.int32) # <<<<<<<<<<<<<<
9718  * for node in range(nNodes_owned, nNodes_global):
9719  * result = cyCheckOwnedVariable(variable_nb_local=node,
9720  */
9721  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 594, __pyx_L1_error)
9722  __Pyx_GOTREF(__pyx_t_5);
9723  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 594, __pyx_L1_error)
9724  __Pyx_GOTREF(__pyx_t_1);
9725  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9726  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 594, __pyx_L1_error)
9727  __Pyx_GOTREF(__pyx_t_5);
9728  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 594, __pyx_L1_error)
9729  __Pyx_GOTREF(__pyx_t_2);
9730  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_int32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 594, __pyx_L1_error)
9731  __Pyx_GOTREF(__pyx_t_3);
9732  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9733  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 594, __pyx_L1_error)
9734  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9735  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__3, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 594, __pyx_L1_error)
9736  __Pyx_GOTREF(__pyx_t_3);
9737  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9738  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9739  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_rank); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 594, __pyx_L1_error)
9740  __Pyx_GOTREF(__pyx_t_5);
9741  if (unlikely(PyDict_SetItem(__pyx_v_nodes_2rank, __pyx_t_5, __pyx_t_3) < 0)) __PYX_ERR(0, 594, __pyx_L1_error)
9742  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9743  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9744  }
9745 
9746  /* "mprans/MeshSmoothing.pyx":595
9747  * for rank in range(comm_size):
9748  * nodes_2rank[rank] = np.zeros(0, dtype=np.int32)
9749  * for node in range(nNodes_owned, nNodes_global): # <<<<<<<<<<<<<<
9750  * result = cyCheckOwnedVariable(variable_nb_local=node,
9751  * rank=my_rank,
9752  */
9753  __pyx_t_7 = __pyx_v_nNodes_global;
9754  __pyx_t_10 = __pyx_t_7;
9755  for (__pyx_t_13 = __pyx_v_nNodes_owned; __pyx_t_13 < __pyx_t_10; __pyx_t_13+=1) {
9756  __pyx_v_node = __pyx_t_13;
9757 
9758  /* "mprans/MeshSmoothing.pyx":596
9759  * nodes_2rank[rank] = np.zeros(0, dtype=np.int32)
9760  * for node in range(nNodes_owned, nNodes_global):
9761  * result = cyCheckOwnedVariable(variable_nb_local=node, # <<<<<<<<<<<<<<
9762  * rank=my_rank,
9763  * nVariables_owned=nNodes_owned,
9764  */
9765  __pyx_t_6 = __pyx_f_6mprans_13MeshSmoothing_cyCheckOwnedVariable(__pyx_v_node, __pyx_v_my_rank, __pyx_v_nNodes_owned, __pyx_v_nodeNumbering_subdomain2global, __pyx_v_nodeOffsets_subdomain_owned); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 596, __pyx_L1_error)
9766  __PYX_XDEC_MEMVIEW(&__pyx_v_result, 1);
9767  __pyx_v_result = __pyx_t_6;
9768  __pyx_t_6.memview = NULL;
9769  __pyx_t_6.data = NULL;
9770 
9771  /* "mprans/MeshSmoothing.pyx":601
9772  * variableNumbering_subdomain2global=nodeNumbering_subdomain2global,
9773  * variableOffsets_subdomain_owned=nodeOffsets_subdomain_owned)
9774  * node_new_rank = result[0] # <<<<<<<<<<<<<<
9775  * new_rank = result[1]
9776  * nodes_2rank[new_rank] = np.append(nodes_2rank[new_rank], node_new_rank)
9777  */
9778  __pyx_t_14 = 0;
9779  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_result.shape[0];
9780  __pyx_v_node_new_rank = (*((int *) ( /* dim=0 */ (__pyx_v_result.data + __pyx_t_14 * __pyx_v_result.strides[0]) )));
9781 
9782  /* "mprans/MeshSmoothing.pyx":602
9783  * variableOffsets_subdomain_owned=nodeOffsets_subdomain_owned)
9784  * node_new_rank = result[0]
9785  * new_rank = result[1] # <<<<<<<<<<<<<<
9786  * nodes_2rank[new_rank] = np.append(nodes_2rank[new_rank], node_new_rank)
9787  * # SEND THOSE NODES TO RELEVANT PROCESSORS
9788  */
9789  __pyx_t_15 = 1;
9790  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_result.shape[0];
9791  __pyx_v_new_rank = (*((int *) ( /* dim=0 */ (__pyx_v_result.data + __pyx_t_15 * __pyx_v_result.strides[0]) )));
9792 
9793  /* "mprans/MeshSmoothing.pyx":603
9794  * node_new_rank = result[0]
9795  * new_rank = result[1]
9796  * nodes_2rank[new_rank] = np.append(nodes_2rank[new_rank], node_new_rank) # <<<<<<<<<<<<<<
9797  * # SEND THOSE NODES TO RELEVANT PROCESSORS
9798  * for rank_recv in range(comm_size):
9799  */
9800  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 603, __pyx_L1_error)
9801  __Pyx_GOTREF(__pyx_t_5);
9802  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_append); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 603, __pyx_L1_error)
9803  __Pyx_GOTREF(__pyx_t_1);
9804  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9805  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_new_rank); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 603, __pyx_L1_error)
9806  __Pyx_GOTREF(__pyx_t_5);
9807  __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_nodes_2rank, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 603, __pyx_L1_error)
9808  __Pyx_GOTREF(__pyx_t_2);
9809  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9810  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_node_new_rank); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 603, __pyx_L1_error)
9811  __Pyx_GOTREF(__pyx_t_5);
9812  __pyx_t_4 = NULL;
9813  __pyx_t_16 = 0;
9814  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
9815  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
9816  if (likely(__pyx_t_4)) {
9817  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
9818  __Pyx_INCREF(__pyx_t_4);
9819  __Pyx_INCREF(function);
9820  __Pyx_DECREF_SET(__pyx_t_1, function);
9821  __pyx_t_16 = 1;
9822  }
9823  }
9824  #if CYTHON_FAST_PYCALL
9825  if (PyFunction_Check(__pyx_t_1)) {
9826  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_2, __pyx_t_5};
9827  __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 603, __pyx_L1_error)
9828  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9829  __Pyx_GOTREF(__pyx_t_3);
9830  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9831  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9832  } else
9833  #endif
9834  #if CYTHON_FAST_PYCCALL
9835  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
9836  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_2, __pyx_t_5};
9837  __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 603, __pyx_L1_error)
9838  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9839  __Pyx_GOTREF(__pyx_t_3);
9840  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9841  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9842  } else
9843  #endif
9844  {
9845  __pyx_t_17 = PyTuple_New(2+__pyx_t_16); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 603, __pyx_L1_error)
9846  __Pyx_GOTREF(__pyx_t_17);
9847  if (__pyx_t_4) {
9848  __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_4); __pyx_t_4 = NULL;
9849  }
9850  __Pyx_GIVEREF(__pyx_t_2);
9851  PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_16, __pyx_t_2);
9852  __Pyx_GIVEREF(__pyx_t_5);
9853  PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_16, __pyx_t_5);
9854  __pyx_t_2 = 0;
9855  __pyx_t_5 = 0;
9856  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_17, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 603, __pyx_L1_error)
9857  __Pyx_GOTREF(__pyx_t_3);
9858  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
9859  }
9860  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9861  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_new_rank); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 603, __pyx_L1_error)
9862  __Pyx_GOTREF(__pyx_t_1);
9863  if (unlikely(PyDict_SetItem(__pyx_v_nodes_2rank, __pyx_t_1, __pyx_t_3) < 0)) __PYX_ERR(0, 603, __pyx_L1_error)
9864  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9865  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9866  }
9867 
9868  /* "mprans/MeshSmoothing.pyx":605
9869  * nodes_2rank[new_rank] = np.append(nodes_2rank[new_rank], node_new_rank)
9870  * # SEND THOSE NODES TO RELEVANT PROCESSORS
9871  * for rank_recv in range(comm_size): # <<<<<<<<<<<<<<
9872  * # -----
9873  * # find length of array to do on processor rank_recv
9874  */
9875  __pyx_t_7 = __pyx_cur_scope->__pyx_v_comm_size;
9876  __pyx_t_10 = __pyx_t_7;
9877  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_10; __pyx_t_13+=1) {
9878  __pyx_v_rank_recv = __pyx_t_13;
9879 
9880  /* "mprans/MeshSmoothing.pyx":608
9881  * # -----
9882  * # find length of array to do on processor rank_recv
9883  * nodes_2rank_values = (nodes_2rank[rank_recv][:]).astype(np.int32) # <<<<<<<<<<<<<<
9884  * nodes_2rank_len = len(nodes_2rank_values)
9885  * array_size = comm.allreduce(nodes_2rank_len, op=MPI.SUM)
9886  */
9887  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rank_recv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 608, __pyx_L1_error)
9888  __Pyx_GOTREF(__pyx_t_1);
9889  __pyx_t_17 = __Pyx_PyDict_GetItem(__pyx_v_nodes_2rank, __pyx_t_1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 608, __pyx_L1_error)
9890  __Pyx_GOTREF(__pyx_t_17);
9891  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9892  __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_17, 0, 0, NULL, NULL, &__pyx_slice__4, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 608, __pyx_L1_error)
9893  __Pyx_GOTREF(__pyx_t_1);
9894  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
9895  __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_astype); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 608, __pyx_L1_error)
9896  __Pyx_GOTREF(__pyx_t_17);
9897  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9898  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 608, __pyx_L1_error)
9899  __Pyx_GOTREF(__pyx_t_1);
9900  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_int32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 608, __pyx_L1_error)
9901  __Pyx_GOTREF(__pyx_t_5);
9902  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9903  __pyx_t_1 = NULL;
9904  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_17))) {
9905  __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_17);
9906  if (likely(__pyx_t_1)) {
9907  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
9908  __Pyx_INCREF(__pyx_t_1);
9909  __Pyx_INCREF(function);
9910  __Pyx_DECREF_SET(__pyx_t_17, function);
9911  }
9912  }
9913  __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_17, __pyx_t_1, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_17, __pyx_t_5);
9914  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
9915  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9916  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 608, __pyx_L1_error)
9917  __Pyx_GOTREF(__pyx_t_3);
9918  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
9919  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 608, __pyx_L1_error)
9920  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9921  __PYX_XDEC_MEMVIEW(&__pyx_v_nodes_2rank_values, 1);
9922  __pyx_v_nodes_2rank_values = __pyx_t_6;
9923  __pyx_t_6.memview = NULL;
9924  __pyx_t_6.data = NULL;
9925 
9926  /* "mprans/MeshSmoothing.pyx":609
9927  * # find length of array to do on processor rank_recv
9928  * nodes_2rank_values = (nodes_2rank[rank_recv][:]).astype(np.int32)
9929  * nodes_2rank_len = len(nodes_2rank_values) # <<<<<<<<<<<<<<
9930  * array_size = comm.allreduce(nodes_2rank_len, op=MPI.SUM)
9931  * # initialise node_2doArray on receiving processor
9932  */
9933  __pyx_t_8 = __Pyx_MemoryView_Len(__pyx_v_nodes_2rank_values);
9934  __pyx_v_nodes_2rank_len = __pyx_t_8;
9935 
9936  /* "mprans/MeshSmoothing.pyx":610
9937  * nodes_2rank_values = (nodes_2rank[rank_recv][:]).astype(np.int32)
9938  * nodes_2rank_len = len(nodes_2rank_values)
9939  * array_size = comm.allreduce(nodes_2rank_len, op=MPI.SUM) # <<<<<<<<<<<<<<
9940  * # initialise node_2doArray on receiving processor
9941  * if rank_recv == my_rank:
9942  */
9943  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_comm, __pyx_n_s_allreduce); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 610, __pyx_L1_error)
9944  __Pyx_GOTREF(__pyx_t_3);
9945  __pyx_t_17 = PyInt_FromSsize_t(__pyx_v_nodes_2rank_len); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 610, __pyx_L1_error)
9946  __Pyx_GOTREF(__pyx_t_17);
9947  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 610, __pyx_L1_error)
9948  __Pyx_GOTREF(__pyx_t_5);
9949  __Pyx_GIVEREF(__pyx_t_17);
9950  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_17);
9951  __pyx_t_17 = 0;
9952  __pyx_t_17 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 610, __pyx_L1_error)
9953  __Pyx_GOTREF(__pyx_t_17);
9954  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_MPI); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 610, __pyx_L1_error)
9955  __Pyx_GOTREF(__pyx_t_1);
9956  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_SUM); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 610, __pyx_L1_error)
9957  __Pyx_GOTREF(__pyx_t_2);
9958  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9959  if (PyDict_SetItem(__pyx_t_17, __pyx_n_s_op, __pyx_t_2) < 0) __PYX_ERR(0, 610, __pyx_L1_error)
9960  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9961  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_17); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 610, __pyx_L1_error)
9962  __Pyx_GOTREF(__pyx_t_2);
9963  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9964  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9965  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
9966  __Pyx_XDECREF_SET(__pyx_v_array_size, __pyx_t_2);
9967  __pyx_t_2 = 0;
9968 
9969  /* "mprans/MeshSmoothing.pyx":612
9970  * array_size = comm.allreduce(nodes_2rank_len, op=MPI.SUM)
9971  * # initialise node_2doArray on receiving processor
9972  * if rank_recv == my_rank: # <<<<<<<<<<<<<<
9973  * nodes_2doArray = np.zeros(array_size, dtype=np.int32)
9974  * # -----
9975  */
9976  __pyx_t_9 = ((__pyx_v_rank_recv == __pyx_v_my_rank) != 0);
9977  if (__pyx_t_9) {
9978 
9979  /* "mprans/MeshSmoothing.pyx":613
9980  * # initialise node_2doArray on receiving processor
9981  * if rank_recv == my_rank:
9982  * nodes_2doArray = np.zeros(array_size, dtype=np.int32) # <<<<<<<<<<<<<<
9983  * # -----
9984  * # get count and disp info for retrieving info from rank_recv later
9985  */
9986  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 613, __pyx_L1_error)
9987  __Pyx_GOTREF(__pyx_t_2);
9988  __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 613, __pyx_L1_error)
9989  __Pyx_GOTREF(__pyx_t_17);
9990  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9991  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 613, __pyx_L1_error)
9992  __Pyx_GOTREF(__pyx_t_2);
9993  __Pyx_INCREF(__pyx_v_array_size);
9994  __Pyx_GIVEREF(__pyx_v_array_size);
9995  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_array_size);
9996  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 613, __pyx_L1_error)
9997  __Pyx_GOTREF(__pyx_t_5);
9998  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 613, __pyx_L1_error)
9999  __Pyx_GOTREF(__pyx_t_3);
10000  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_int32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 613, __pyx_L1_error)
10001  __Pyx_GOTREF(__pyx_t_1);
10002  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10003  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 613, __pyx_L1_error)
10004  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10005  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 613, __pyx_L1_error)
10006  __Pyx_GOTREF(__pyx_t_1);
10007  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
10008  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10009  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10010  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 613, __pyx_L1_error)
10011  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10012  __PYX_XDEC_MEMVIEW(&__pyx_v_nodes_2doArray, 1);
10013  __pyx_v_nodes_2doArray = __pyx_t_6;
10014  __pyx_t_6.memview = NULL;
10015  __pyx_t_6.data = NULL;
10016 
10017  /* "mprans/MeshSmoothing.pyx":612
10018  * array_size = comm.allreduce(nodes_2rank_len, op=MPI.SUM)
10019  * # initialise node_2doArray on receiving processor
10020  * if rank_recv == my_rank: # <<<<<<<<<<<<<<
10021  * nodes_2doArray = np.zeros(array_size, dtype=np.int32)
10022  * # -----
10023  */
10024  }
10025 
10026  /* "mprans/MeshSmoothing.pyx":617
10027  * # get count and disp info for retrieving info from rank_recv later
10028  * # counts_out[rank_recv] = nodes_2rank_len
10029  * counts_out[rank_recv] = nodes_2rank_len # <<<<<<<<<<<<<<
10030  * if rank_recv > 0:
10031  * displacements_out[rank_recv] = (displacements_out[rank_recv-1]+counts_out[rank_recv-1])
10032  */
10033  __pyx_t_18 = __pyx_v_rank_recv;
10034  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_counts_out.shape[0];
10035  *((int *) ( /* dim=0 */ (__pyx_v_counts_out.data + __pyx_t_18 * __pyx_v_counts_out.strides[0]) )) = __pyx_v_nodes_2rank_len;
10036 
10037  /* "mprans/MeshSmoothing.pyx":618
10038  * # counts_out[rank_recv] = nodes_2rank_len
10039  * counts_out[rank_recv] = nodes_2rank_len
10040  * if rank_recv > 0: # <<<<<<<<<<<<<<
10041  * displacements_out[rank_recv] = (displacements_out[rank_recv-1]+counts_out[rank_recv-1])
10042  * # -----
10043  */
10044  __pyx_t_9 = ((__pyx_v_rank_recv > 0) != 0);
10045  if (__pyx_t_9) {
10046 
10047  /* "mprans/MeshSmoothing.pyx":619
10048  * counts_out[rank_recv] = nodes_2rank_len
10049  * if rank_recv > 0:
10050  * displacements_out[rank_recv] = (displacements_out[rank_recv-1]+counts_out[rank_recv-1]) # <<<<<<<<<<<<<<
10051  * # -----
10052  * # get count and disp info for receiving array on rank_recv
10053  */
10054  __pyx_t_19 = (__pyx_v_rank_recv - 1);
10055  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_displacements_out.shape[0];
10056  __pyx_t_20 = (__pyx_v_rank_recv - 1);
10057  if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_counts_out.shape[0];
10058  __pyx_t_21 = __pyx_v_rank_recv;
10059  if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_displacements_out.shape[0];
10060  *((int *) ( /* dim=0 */ (__pyx_v_displacements_out.data + __pyx_t_21 * __pyx_v_displacements_out.strides[0]) )) = ((*((int *) ( /* dim=0 */ (__pyx_v_displacements_out.data + __pyx_t_19 * __pyx_v_displacements_out.strides[0]) ))) + (*((int *) ( /* dim=0 */ (__pyx_v_counts_out.data + __pyx_t_20 * __pyx_v_counts_out.strides[0]) ))));
10061 
10062  /* "mprans/MeshSmoothing.pyx":618
10063  * # counts_out[rank_recv] = nodes_2rank_len
10064  * counts_out[rank_recv] = nodes_2rank_len
10065  * if rank_recv > 0: # <<<<<<<<<<<<<<
10066  * displacements_out[rank_recv] = (displacements_out[rank_recv-1]+counts_out[rank_recv-1])
10067  * # -----
10068  */
10069  }
10070 
10071  /* "mprans/MeshSmoothing.pyx":622
10072  * # -----
10073  * # get count and disp info for receiving array on rank_recv
10074  * my_size = np.array([nodes_2rank_len], dtype=np.int32) # <<<<<<<<<<<<<<
10075  * comm.Gatherv(my_size,
10076  * [counts_in,
10077  */
10078  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 622, __pyx_L1_error)
10079  __Pyx_GOTREF(__pyx_t_1);
10080  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 622, __pyx_L1_error)
10081  __Pyx_GOTREF(__pyx_t_5);
10082  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10083  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_nodes_2rank_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 622, __pyx_L1_error)
10084  __Pyx_GOTREF(__pyx_t_1);
10085  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 622, __pyx_L1_error)
10086  __Pyx_GOTREF(__pyx_t_2);
10087  __Pyx_GIVEREF(__pyx_t_1);
10088  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
10089  __pyx_t_1 = 0;
10090  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 622, __pyx_L1_error)
10091  __Pyx_GOTREF(__pyx_t_1);
10092  __Pyx_GIVEREF(__pyx_t_2);
10093  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
10094  __pyx_t_2 = 0;
10095  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 622, __pyx_L1_error)
10096  __Pyx_GOTREF(__pyx_t_2);
10097  __Pyx_GetModuleGlobalName(__pyx_t_17, __pyx_n_s_np); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 622, __pyx_L1_error)
10098  __Pyx_GOTREF(__pyx_t_17);
10099  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_int32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 622, __pyx_L1_error)
10100  __Pyx_GOTREF(__pyx_t_3);
10101  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
10102  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 622, __pyx_L1_error)
10103  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10104  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 622, __pyx_L1_error)
10105  __Pyx_GOTREF(__pyx_t_3);
10106  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10107  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10108  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10109  __Pyx_XDECREF_SET(__pyx_v_my_size, __pyx_t_3);
10110  __pyx_t_3 = 0;
10111 
10112  /* "mprans/MeshSmoothing.pyx":623
10113  * # get count and disp info for receiving array on rank_recv
10114  * my_size = np.array([nodes_2rank_len], dtype=np.int32)
10115  * comm.Gatherv(my_size, # <<<<<<<<<<<<<<
10116  * [counts_in,
10117  * tuple(1 for i in range(comm_size)),
10118  */
10119  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_comm, __pyx_n_s_Gatherv); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 623, __pyx_L1_error)
10120  __Pyx_GOTREF(__pyx_t_3);
10121 
10122  /* "mprans/MeshSmoothing.pyx":624
10123  * my_size = np.array([nodes_2rank_len], dtype=np.int32)
10124  * comm.Gatherv(my_size,
10125  * [counts_in, # <<<<<<<<<<<<<<
10126  * tuple(1 for i in range(comm_size)),
10127  * tuple(i for i in range(comm_size)),
10128  */
10129  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_counts_in, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 624, __pyx_L1_error)
10130  __Pyx_GOTREF(__pyx_t_2);
10131 
10132  /* "mprans/MeshSmoothing.pyx":625
10133  * comm.Gatherv(my_size,
10134  * [counts_in,
10135  * tuple(1 for i in range(comm_size)), # <<<<<<<<<<<<<<
10136  * tuple(i for i in range(comm_size)),
10137  * MPI.INT],
10138  */
10139  __pyx_t_1 = __pyx_pf_6mprans_13MeshSmoothing_21getNonOwnedNodeValues_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 625, __pyx_L1_error)
10140  __Pyx_GOTREF(__pyx_t_1);
10141  __pyx_t_5 = __Pyx_PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 625, __pyx_L1_error)
10142  __Pyx_GOTREF(__pyx_t_5);
10143  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10144 
10145  /* "mprans/MeshSmoothing.pyx":626
10146  * [counts_in,
10147  * tuple(1 for i in range(comm_size)),
10148  * tuple(i for i in range(comm_size)), # <<<<<<<<<<<<<<
10149  * MPI.INT],
10150  * root=rank_recv
10151  */
10152  __pyx_t_1 = __pyx_pf_6mprans_13MeshSmoothing_21getNonOwnedNodeValues_3genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 626, __pyx_L1_error)
10153  __Pyx_GOTREF(__pyx_t_1);
10154  __pyx_t_17 = __Pyx_PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 626, __pyx_L1_error)
10155  __Pyx_GOTREF(__pyx_t_17);
10156  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10157 
10158  /* "mprans/MeshSmoothing.pyx":627
10159  * tuple(1 for i in range(comm_size)),
10160  * tuple(i for i in range(comm_size)),
10161  * MPI.INT], # <<<<<<<<<<<<<<
10162  * root=rank_recv
10163  * )
10164  */
10165  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_MPI); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 627, __pyx_L1_error)
10166  __Pyx_GOTREF(__pyx_t_1);
10167  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 627, __pyx_L1_error)
10168  __Pyx_GOTREF(__pyx_t_4);
10169  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10170 
10171  /* "mprans/MeshSmoothing.pyx":624
10172  * my_size = np.array([nodes_2rank_len], dtype=np.int32)
10173  * comm.Gatherv(my_size,
10174  * [counts_in, # <<<<<<<<<<<<<<
10175  * tuple(1 for i in range(comm_size)),
10176  * tuple(i for i in range(comm_size)),
10177  */
10178  __pyx_t_1 = PyList_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 624, __pyx_L1_error)
10179  __Pyx_GOTREF(__pyx_t_1);
10180  __Pyx_GIVEREF(__pyx_t_2);
10181  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
10182  __Pyx_GIVEREF(__pyx_t_5);
10183  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_t_5);
10184  __Pyx_GIVEREF(__pyx_t_17);
10185  PyList_SET_ITEM(__pyx_t_1, 2, __pyx_t_17);
10186  __Pyx_GIVEREF(__pyx_t_4);
10187  PyList_SET_ITEM(__pyx_t_1, 3, __pyx_t_4);
10188  __pyx_t_2 = 0;
10189  __pyx_t_5 = 0;
10190  __pyx_t_17 = 0;
10191  __pyx_t_4 = 0;
10192 
10193  /* "mprans/MeshSmoothing.pyx":623
10194  * # get count and disp info for receiving array on rank_recv
10195  * my_size = np.array([nodes_2rank_len], dtype=np.int32)
10196  * comm.Gatherv(my_size, # <<<<<<<<<<<<<<
10197  * [counts_in,
10198  * tuple(1 for i in range(comm_size)),
10199  */
10200  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 623, __pyx_L1_error)
10201  __Pyx_GOTREF(__pyx_t_4);
10202  __Pyx_INCREF(__pyx_v_my_size);
10203  __Pyx_GIVEREF(__pyx_v_my_size);
10204  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_my_size);
10205  __Pyx_GIVEREF(__pyx_t_1);
10206  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
10207  __pyx_t_1 = 0;
10208 
10209  /* "mprans/MeshSmoothing.pyx":628
10210  * tuple(i for i in range(comm_size)),
10211  * MPI.INT],
10212  * root=rank_recv # <<<<<<<<<<<<<<
10213  * )
10214  * if rank_recv == my_rank:
10215  */
10216  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 628, __pyx_L1_error)
10217  __Pyx_GOTREF(__pyx_t_1);
10218  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_rank_recv); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 628, __pyx_L1_error)
10219  __Pyx_GOTREF(__pyx_t_17);
10220  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_root, __pyx_t_17) < 0) __PYX_ERR(0, 628, __pyx_L1_error)
10221  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
10222 
10223  /* "mprans/MeshSmoothing.pyx":623
10224  * # get count and disp info for receiving array on rank_recv
10225  * my_size = np.array([nodes_2rank_len], dtype=np.int32)
10226  * comm.Gatherv(my_size, # <<<<<<<<<<<<<<
10227  * [counts_in,
10228  * tuple(1 for i in range(comm_size)),
10229  */
10230  __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 623, __pyx_L1_error)
10231  __Pyx_GOTREF(__pyx_t_17);
10232  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10233  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10234  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10235  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
10236 
10237  /* "mprans/MeshSmoothing.pyx":630
10238  * root=rank_recv
10239  * )
10240  * if rank_recv == my_rank: # <<<<<<<<<<<<<<
10241  * sumtot = 0
10242  * for ir in range(comm_size):
10243  */
10244  __pyx_t_9 = ((__pyx_v_rank_recv == __pyx_v_my_rank) != 0);
10245  if (__pyx_t_9) {
10246 
10247  /* "mprans/MeshSmoothing.pyx":631
10248  * )
10249  * if rank_recv == my_rank:
10250  * sumtot = 0 # <<<<<<<<<<<<<<
10251  * for ir in range(comm_size):
10252  * if ir > 0:
10253  */
10254  __pyx_v_sumtot = 0;
10255 
10256  /* "mprans/MeshSmoothing.pyx":632
10257  * if rank_recv == my_rank:
10258  * sumtot = 0
10259  * for ir in range(comm_size): # <<<<<<<<<<<<<<
10260  * if ir > 0:
10261  * sumtot += counts_in[ir-1]
10262  */
10263  __pyx_t_16 = __pyx_cur_scope->__pyx_v_comm_size;
10264  __pyx_t_22 = __pyx_t_16;
10265  for (__pyx_t_23 = 0; __pyx_t_23 < __pyx_t_22; __pyx_t_23+=1) {
10266  __pyx_v_ir = __pyx_t_23;
10267 
10268  /* "mprans/MeshSmoothing.pyx":633
10269  * sumtot = 0
10270  * for ir in range(comm_size):
10271  * if ir > 0: # <<<<<<<<<<<<<<
10272  * sumtot += counts_in[ir-1]
10273  * if counts_in[ir] == 0:
10274  */
10275  __pyx_t_9 = ((__pyx_v_ir > 0) != 0);
10276  if (__pyx_t_9) {
10277 
10278  /* "mprans/MeshSmoothing.pyx":634
10279  * for ir in range(comm_size):
10280  * if ir > 0:
10281  * sumtot += counts_in[ir-1] # <<<<<<<<<<<<<<
10282  * if counts_in[ir] == 0:
10283  * displacements_in[ir] = 0
10284  */
10285  __pyx_t_24 = (__pyx_v_ir - 1);
10286  if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_counts_in.shape[0];
10287  __pyx_v_sumtot = (__pyx_v_sumtot + (*((int *) ( /* dim=0 */ (__pyx_v_counts_in.data + __pyx_t_24 * __pyx_v_counts_in.strides[0]) ))));
10288 
10289  /* "mprans/MeshSmoothing.pyx":635
10290  * if ir > 0:
10291  * sumtot += counts_in[ir-1]
10292  * if counts_in[ir] == 0: # <<<<<<<<<<<<<<
10293  * displacements_in[ir] = 0
10294  * else:
10295  */
10296  __pyx_t_25 = __pyx_v_ir;
10297  if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_counts_in.shape[0];
10298  __pyx_t_9 = (((*((int *) ( /* dim=0 */ (__pyx_v_counts_in.data + __pyx_t_25 * __pyx_v_counts_in.strides[0]) ))) == 0) != 0);
10299  if (__pyx_t_9) {
10300 
10301  /* "mprans/MeshSmoothing.pyx":636
10302  * sumtot += counts_in[ir-1]
10303  * if counts_in[ir] == 0:
10304  * displacements_in[ir] = 0 # <<<<<<<<<<<<<<
10305  * else:
10306  * displacements_in[ir] = sumtot
10307  */
10308  __pyx_t_26 = __pyx_v_ir;
10309  if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_displacements_in.shape[0];
10310  *((int *) ( /* dim=0 */ (__pyx_v_displacements_in.data + __pyx_t_26 * __pyx_v_displacements_in.strides[0]) )) = 0;
10311 
10312  /* "mprans/MeshSmoothing.pyx":635
10313  * if ir > 0:
10314  * sumtot += counts_in[ir-1]
10315  * if counts_in[ir] == 0: # <<<<<<<<<<<<<<
10316  * displacements_in[ir] = 0
10317  * else:
10318  */
10319  goto __pyx_L19;
10320  }
10321 
10322  /* "mprans/MeshSmoothing.pyx":638
10323  * displacements_in[ir] = 0
10324  * else:
10325  * displacements_in[ir] = sumtot # <<<<<<<<<<<<<<
10326  * # -----
10327  * # get the nodes_2doArray (nodes where to retrieve values for arg)
10328  */
10329  /*else*/ {
10330  __pyx_t_27 = __pyx_v_ir;
10331  if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_displacements_in.shape[0];
10332  *((int *) ( /* dim=0 */ (__pyx_v_displacements_in.data + __pyx_t_27 * __pyx_v_displacements_in.strides[0]) )) = __pyx_v_sumtot;
10333  }
10334  __pyx_L19:;
10335 
10336  /* "mprans/MeshSmoothing.pyx":633
10337  * sumtot = 0
10338  * for ir in range(comm_size):
10339  * if ir > 0: # <<<<<<<<<<<<<<
10340  * sumtot += counts_in[ir-1]
10341  * if counts_in[ir] == 0:
10342  */
10343  }
10344  }
10345 
10346  /* "mprans/MeshSmoothing.pyx":630
10347  * root=rank_recv
10348  * )
10349  * if rank_recv == my_rank: # <<<<<<<<<<<<<<
10350  * sumtot = 0
10351  * for ir in range(comm_size):
10352  */
10353  }
10354 
10355  /* "mprans/MeshSmoothing.pyx":642
10356  * # get the nodes_2doArray (nodes where to retrieve values for arg)
10357  * # datatype = MPI.INT.Create_contiguous(2).Commit()
10358  * comm.Gatherv(nodes_2rank_values, # <<<<<<<<<<<<<<
10359  * [nodes_2doArray,
10360  * counts_in,
10361  */
10362  __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_comm, __pyx_n_s_Gatherv); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 642, __pyx_L1_error)
10363  __Pyx_GOTREF(__pyx_t_17);
10364  __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_nodes_2rank_values, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 642, __pyx_L1_error)
10365  __Pyx_GOTREF(__pyx_t_1);
10366 
10367  /* "mprans/MeshSmoothing.pyx":643
10368  * # datatype = MPI.INT.Create_contiguous(2).Commit()
10369  * comm.Gatherv(nodes_2rank_values,
10370  * [nodes_2doArray, # <<<<<<<<<<<<<<
10371  * counts_in,
10372  * displacements_in,
10373  */
10374  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_nodes_2doArray, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 643, __pyx_L1_error)
10375  __Pyx_GOTREF(__pyx_t_4);
10376 
10377  /* "mprans/MeshSmoothing.pyx":644
10378  * comm.Gatherv(nodes_2rank_values,
10379  * [nodes_2doArray,
10380  * counts_in, # <<<<<<<<<<<<<<
10381  * displacements_in,
10382  * MPI.INT],
10383  */
10384  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_counts_in, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 644, __pyx_L1_error)
10385  __Pyx_GOTREF(__pyx_t_3);
10386 
10387  /* "mprans/MeshSmoothing.pyx":645
10388  * [nodes_2doArray,
10389  * counts_in,
10390  * displacements_in, # <<<<<<<<<<<<<<
10391  * MPI.INT],
10392  * root=rank_recv)
10393  */
10394  __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_displacements_in, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 645, __pyx_L1_error)
10395  __Pyx_GOTREF(__pyx_t_5);
10396 
10397  /* "mprans/MeshSmoothing.pyx":646
10398  * counts_in,
10399  * displacements_in,
10400  * MPI.INT], # <<<<<<<<<<<<<<
10401  * root=rank_recv)
10402  * # SEND VALUE BACK TO ORIGINAL PROCESSORS
10403  */
10404  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_MPI); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 646, __pyx_L1_error)
10405  __Pyx_GOTREF(__pyx_t_2);
10406  __pyx_t_28 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_INT); if (unlikely(!__pyx_t_28)) __PYX_ERR(0, 646, __pyx_L1_error)
10407  __Pyx_GOTREF(__pyx_t_28);
10408  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10409 
10410  /* "mprans/MeshSmoothing.pyx":643
10411  * # datatype = MPI.INT.Create_contiguous(2).Commit()
10412  * comm.Gatherv(nodes_2rank_values,
10413  * [nodes_2doArray, # <<<<<<<<<<<<<<
10414  * counts_in,
10415  * displacements_in,
10416  */
10417  __pyx_t_2 = PyList_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 643, __pyx_L1_error)
10418  __Pyx_GOTREF(__pyx_t_2);
10419  __Pyx_GIVEREF(__pyx_t_4);
10420  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
10421  __Pyx_GIVEREF(__pyx_t_3);
10422  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
10423  __Pyx_GIVEREF(__pyx_t_5);
10424  PyList_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
10425  __Pyx_GIVEREF(__pyx_t_28);
10426  PyList_SET_ITEM(__pyx_t_2, 3, __pyx_t_28);
10427  __pyx_t_4 = 0;
10428  __pyx_t_3 = 0;
10429  __pyx_t_5 = 0;
10430  __pyx_t_28 = 0;
10431 
10432  /* "mprans/MeshSmoothing.pyx":642
10433  * # get the nodes_2doArray (nodes where to retrieve values for arg)
10434  * # datatype = MPI.INT.Create_contiguous(2).Commit()
10435  * comm.Gatherv(nodes_2rank_values, # <<<<<<<<<<<<<<
10436  * [nodes_2doArray,
10437  * counts_in,
10438  */
10439  __pyx_t_28 = PyTuple_New(2); if (unlikely(!__pyx_t_28)) __PYX_ERR(0, 642, __pyx_L1_error)
10440  __Pyx_GOTREF(__pyx_t_28);
10441  __Pyx_GIVEREF(__pyx_t_1);
10442  PyTuple_SET_ITEM(__pyx_t_28, 0, __pyx_t_1);
10443  __Pyx_GIVEREF(__pyx_t_2);
10444  PyTuple_SET_ITEM(__pyx_t_28, 1, __pyx_t_2);
10445  __pyx_t_1 = 0;
10446  __pyx_t_2 = 0;
10447 
10448  /* "mprans/MeshSmoothing.pyx":647
10449  * displacements_in,
10450  * MPI.INT],
10451  * root=rank_recv) # <<<<<<<<<<<<<<
10452  * # SEND VALUE BACK TO ORIGINAL PROCESSORS
10453  * arg_shape_copy[0] = 0
10454  */
10455  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 647, __pyx_L1_error)
10456  __Pyx_GOTREF(__pyx_t_2);
10457  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rank_recv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 647, __pyx_L1_error)
10458  __Pyx_GOTREF(__pyx_t_1);
10459  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_root, __pyx_t_1) < 0) __PYX_ERR(0, 647, __pyx_L1_error)
10460  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10461 
10462  /* "mprans/MeshSmoothing.pyx":642
10463  * # get the nodes_2doArray (nodes where to retrieve values for arg)
10464  * # datatype = MPI.INT.Create_contiguous(2).Commit()
10465  * comm.Gatherv(nodes_2rank_values, # <<<<<<<<<<<<<<
10466  * [nodes_2doArray,
10467  * counts_in,
10468  */
10469  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_28, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 642, __pyx_L1_error)
10470  __Pyx_GOTREF(__pyx_t_1);
10471  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
10472  __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0;
10473  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10474  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10475  }
10476 
10477  /* "mprans/MeshSmoothing.pyx":649
10478  * root=rank_recv)
10479  * # SEND VALUE BACK TO ORIGINAL PROCESSORS
10480  * arg_shape_copy[0] = 0 # <<<<<<<<<<<<<<
10481  * for rank in range(comm_size):
10482  * # create empty arrays
10483  */
10484  __pyx_t_29 = 0;
10485  if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_arg_shape_copy.shape[0];
10486  *((int *) ( /* dim=0 */ (__pyx_v_arg_shape_copy.data + __pyx_t_29 * __pyx_v_arg_shape_copy.strides[0]) )) = 0;
10487 
10488  /* "mprans/MeshSmoothing.pyx":650
10489  * # SEND VALUE BACK TO ORIGINAL PROCESSORS
10490  * arg_shape_copy[0] = 0
10491  * for rank in range(comm_size): # <<<<<<<<<<<<<<
10492  * # create empty arrays
10493  * arg_shape_copy[0] = counts_in[rank]
10494  */
10495  __pyx_t_7 = __pyx_cur_scope->__pyx_v_comm_size;
10496  __pyx_t_10 = __pyx_t_7;
10497  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_10; __pyx_t_13+=1) {
10498  __pyx_v_rank = __pyx_t_13;
10499 
10500  /* "mprans/MeshSmoothing.pyx":652
10501  * for rank in range(comm_size):
10502  * # create empty arrays
10503  * arg_shape_copy[0] = counts_in[rank] # <<<<<<<<<<<<<<
10504  * arg_2rank[rank] = np.zeros(arg_shape_copy)
10505  * # build array of arg to send back
10506  */
10507  __pyx_t_30 = __pyx_v_rank;
10508  if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_counts_in.shape[0];
10509  __pyx_t_31 = 0;
10510  if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_arg_shape_copy.shape[0];
10511  *((int *) ( /* dim=0 */ (__pyx_v_arg_shape_copy.data + __pyx_t_31 * __pyx_v_arg_shape_copy.strides[0]) )) = (*((int *) ( /* dim=0 */ (__pyx_v_counts_in.data + __pyx_t_30 * __pyx_v_counts_in.strides[0]) )));
10512 
10513  /* "mprans/MeshSmoothing.pyx":653
10514  * # create empty arrays
10515  * arg_shape_copy[0] = counts_in[rank]
10516  * arg_2rank[rank] = np.zeros(arg_shape_copy) # <<<<<<<<<<<<<<
10517  * # build array of arg to send back
10518  * for rank in range(comm_size):
10519  */
10520  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 653, __pyx_L1_error)
10521  __Pyx_GOTREF(__pyx_t_2);
10522  __pyx_t_28 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_28)) __PYX_ERR(0, 653, __pyx_L1_error)
10523  __Pyx_GOTREF(__pyx_t_28);
10524  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10525  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_arg_shape_copy, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 653, __pyx_L1_error)
10526  __Pyx_GOTREF(__pyx_t_2);
10527  __pyx_t_17 = NULL;
10528  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_28))) {
10529  __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_28);
10530  if (likely(__pyx_t_17)) {
10531  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_28);
10532  __Pyx_INCREF(__pyx_t_17);
10533  __Pyx_INCREF(function);
10534  __Pyx_DECREF_SET(__pyx_t_28, function);
10535  }
10536  }
10537  __pyx_t_1 = (__pyx_t_17) ? __Pyx_PyObject_Call2Args(__pyx_t_28, __pyx_t_17, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_28, __pyx_t_2);
10538  __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
10539  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10540  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 653, __pyx_L1_error)
10541  __Pyx_GOTREF(__pyx_t_1);
10542  __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0;
10543  __pyx_t_28 = __Pyx_PyInt_From_int(__pyx_v_rank); if (unlikely(!__pyx_t_28)) __PYX_ERR(0, 653, __pyx_L1_error)
10544  __Pyx_GOTREF(__pyx_t_28);
10545  if (unlikely(PyDict_SetItem(__pyx_v_arg_2rank, __pyx_t_28, __pyx_t_1) < 0)) __PYX_ERR(0, 653, __pyx_L1_error)
10546  __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0;
10547  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10548  }
10549 
10550  /* "mprans/MeshSmoothing.pyx":655
10551  * arg_2rank[rank] = np.zeros(arg_shape_copy)
10552  * # build array of arg to send back
10553  * for rank in range(comm_size): # <<<<<<<<<<<<<<
10554  * arg_2rank_values = arg_2rank[rank]
10555  * disp = displacements_in[rank]
10556  */
10557  __pyx_t_7 = __pyx_cur_scope->__pyx_v_comm_size;
10558  __pyx_t_10 = __pyx_t_7;
10559  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_10; __pyx_t_13+=1) {
10560  __pyx_v_rank = __pyx_t_13;
10561 
10562  /* "mprans/MeshSmoothing.pyx":656
10563  * # build array of arg to send back
10564  * for rank in range(comm_size):
10565  * arg_2rank_values = arg_2rank[rank] # <<<<<<<<<<<<<<
10566  * disp = displacements_in[rank]
10567  * for iN in range(counts_in[rank]):
10568  */
10569  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rank); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 656, __pyx_L1_error)
10570  __Pyx_GOTREF(__pyx_t_1);
10571  __pyx_t_28 = __Pyx_PyDict_GetItem(__pyx_v_arg_2rank, __pyx_t_1); if (unlikely(!__pyx_t_28)) __PYX_ERR(0, 656, __pyx_L1_error)
10572  __Pyx_GOTREF(__pyx_t_28);
10573  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10574  __Pyx_XDECREF_SET(__pyx_v_arg_2rank_values, __pyx_t_28);
10575  __pyx_t_28 = 0;
10576 
10577  /* "mprans/MeshSmoothing.pyx":657
10578  * for rank in range(comm_size):
10579  * arg_2rank_values = arg_2rank[rank]
10580  * disp = displacements_in[rank] # <<<<<<<<<<<<<<
10581  * for iN in range(counts_in[rank]):
10582  * if arg_shape_len > 1:
10583  */
10584  __pyx_t_32 = __pyx_v_rank;
10585  if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_displacements_in.shape[0];
10586  __pyx_v_disp = (*((int *) ( /* dim=0 */ (__pyx_v_displacements_in.data + __pyx_t_32 * __pyx_v_displacements_in.strides[0]) )));
10587 
10588  /* "mprans/MeshSmoothing.pyx":658
10589  * arg_2rank_values = arg_2rank[rank]
10590  * disp = displacements_in[rank]
10591  * for iN in range(counts_in[rank]): # <<<<<<<<<<<<<<
10592  * if arg_shape_len > 1:
10593  * for ii in range(arg_shape[1]):
10594  */
10595  __pyx_t_33 = __pyx_v_rank;
10596  if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_counts_in.shape[0];
10597  __pyx_t_16 = (*((int *) ( /* dim=0 */ (__pyx_v_counts_in.data + __pyx_t_33 * __pyx_v_counts_in.strides[0]) )));
10598  __pyx_t_22 = __pyx_t_16;
10599  for (__pyx_t_23 = 0; __pyx_t_23 < __pyx_t_22; __pyx_t_23+=1) {
10600  __pyx_v_iN = __pyx_t_23;
10601 
10602  /* "mprans/MeshSmoothing.pyx":659
10603  * disp = displacements_in[rank]
10604  * for iN in range(counts_in[rank]):
10605  * if arg_shape_len > 1: # <<<<<<<<<<<<<<
10606  * for ii in range(arg_shape[1]):
10607  * arg_2rank_values[iN, ii] = args_[nodes_2doArray[iN+disp], ii]
10608  */
10609  __pyx_t_9 = ((__pyx_v_arg_shape_len > 1) != 0);
10610  if (__pyx_t_9) {
10611 
10612  /* "mprans/MeshSmoothing.pyx":660
10613  * for iN in range(counts_in[rank]):
10614  * if arg_shape_len > 1:
10615  * for ii in range(arg_shape[1]): # <<<<<<<<<<<<<<
10616  * arg_2rank_values[iN, ii] = args_[nodes_2doArray[iN+disp], ii]
10617  * else:
10618  */
10619  __pyx_t_34 = 1;
10620  if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_arg_shape.shape[0];
10621  __pyx_t_35 = (*((int *) ( /* dim=0 */ (__pyx_v_arg_shape.data + __pyx_t_34 * __pyx_v_arg_shape.strides[0]) )));
10622  __pyx_t_36 = __pyx_t_35;
10623  for (__pyx_t_37 = 0; __pyx_t_37 < __pyx_t_36; __pyx_t_37+=1) {
10624  __pyx_v_ii = __pyx_t_37;
10625 
10626  /* "mprans/MeshSmoothing.pyx":661
10627  * if arg_shape_len > 1:
10628  * for ii in range(arg_shape[1]):
10629  * arg_2rank_values[iN, ii] = args_[nodes_2doArray[iN+disp], ii] # <<<<<<<<<<<<<<
10630  * else:
10631  * arg_2rank_values[iN] = args_[nodes_2doArray[iN+disp]]
10632  */
10633  __pyx_t_38 = (__pyx_v_iN + __pyx_v_disp);
10634  if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_nodes_2doArray.shape[0];
10635  __pyx_t_28 = __Pyx_PyInt_From_int((*((int *) ( /* dim=0 */ (__pyx_v_nodes_2doArray.data + __pyx_t_38 * __pyx_v_nodes_2doArray.strides[0]) )))); if (unlikely(!__pyx_t_28)) __PYX_ERR(0, 661, __pyx_L1_error)
10636  __Pyx_GOTREF(__pyx_t_28);
10637  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_ii); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 661, __pyx_L1_error)
10638  __Pyx_GOTREF(__pyx_t_1);
10639  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 661, __pyx_L1_error)
10640  __Pyx_GOTREF(__pyx_t_2);
10641  __Pyx_GIVEREF(__pyx_t_28);
10642  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_28);
10643  __Pyx_GIVEREF(__pyx_t_1);
10644  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
10645  __pyx_t_28 = 0;
10646  __pyx_t_1 = 0;
10647  __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_args_, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 661, __pyx_L1_error)
10648  __Pyx_GOTREF(__pyx_t_1);
10649  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10650  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_iN); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 661, __pyx_L1_error)
10651  __Pyx_GOTREF(__pyx_t_2);
10652  __pyx_t_28 = __Pyx_PyInt_From_int(__pyx_v_ii); if (unlikely(!__pyx_t_28)) __PYX_ERR(0, 661, __pyx_L1_error)
10653  __Pyx_GOTREF(__pyx_t_28);
10654  __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 661, __pyx_L1_error)
10655  __Pyx_GOTREF(__pyx_t_17);
10656  __Pyx_GIVEREF(__pyx_t_2);
10657  PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_2);
10658  __Pyx_GIVEREF(__pyx_t_28);
10659  PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_28);
10660  __pyx_t_2 = 0;
10661  __pyx_t_28 = 0;
10662  if (unlikely(PyObject_SetItem(__pyx_v_arg_2rank_values, __pyx_t_17, __pyx_t_1) < 0)) __PYX_ERR(0, 661, __pyx_L1_error)
10663  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
10664  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10665  }
10666 
10667  /* "mprans/MeshSmoothing.pyx":659
10668  * disp = displacements_in[rank]
10669  * for iN in range(counts_in[rank]):
10670  * if arg_shape_len > 1: # <<<<<<<<<<<<<<
10671  * for ii in range(arg_shape[1]):
10672  * arg_2rank_values[iN, ii] = args_[nodes_2doArray[iN+disp], ii]
10673  */
10674  goto __pyx_L26;
10675  }
10676 
10677  /* "mprans/MeshSmoothing.pyx":663
10678  * arg_2rank_values[iN, ii] = args_[nodes_2doArray[iN+disp], ii]
10679  * else:
10680  * arg_2rank_values[iN] = args_[nodes_2doArray[iN+disp]] # <<<<<<<<<<<<<<
10681  * # retrieve solution
10682  * arg_shape_copy[0] = nNodes_global-nNodes_owned
10683  */
10684  /*else*/ {
10685  __pyx_t_39 = (__pyx_v_iN + __pyx_v_disp);
10686  if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_v_nodes_2doArray.shape[0];
10687  __pyx_t_35 = (*((int *) ( /* dim=0 */ (__pyx_v_nodes_2doArray.data + __pyx_t_39 * __pyx_v_nodes_2doArray.strides[0]) )));
10688  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_args_, __pyx_t_35, int, 1, __Pyx_PyInt_From_int, 0, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 663, __pyx_L1_error)
10689  __Pyx_GOTREF(__pyx_t_1);
10690  if (unlikely(__Pyx_SetItemInt(__pyx_v_arg_2rank_values, __pyx_v_iN, __pyx_t_1, int, 1, __Pyx_PyInt_From_int, 0, 1, 0) < 0)) __PYX_ERR(0, 663, __pyx_L1_error)
10691  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10692  }
10693  __pyx_L26:;
10694  }
10695  }
10696 
10697  /* "mprans/MeshSmoothing.pyx":665
10698  * arg_2rank_values[iN] = args_[nodes_2doArray[iN+disp]]
10699  * # retrieve solution
10700  * arg_shape_copy[0] = nNodes_global-nNodes_owned # <<<<<<<<<<<<<<
10701  * arg_2doArray = np.zeros(arg_shape_copy, dtype=np.double)
10702  * for rank_recv in range(comm_size):
10703  */
10704  __pyx_t_40 = 0;
10705  if (__pyx_t_40 < 0) __pyx_t_40 += __pyx_v_arg_shape_copy.shape[0];
10706  *((int *) ( /* dim=0 */ (__pyx_v_arg_shape_copy.data + __pyx_t_40 * __pyx_v_arg_shape_copy.strides[0]) )) = (__pyx_v_nNodes_global - __pyx_v_nNodes_owned);
10707 
10708  /* "mprans/MeshSmoothing.pyx":666
10709  * # retrieve solution
10710  * arg_shape_copy[0] = nNodes_global-nNodes_owned
10711  * arg_2doArray = np.zeros(arg_shape_copy, dtype=np.double) # <<<<<<<<<<<<<<
10712  * for rank_recv in range(comm_size):
10713  * arg_2rank_values = arg_2rank[rank_recv].astype(np.double)
10714  */
10715  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 666, __pyx_L1_error)
10716  __Pyx_GOTREF(__pyx_t_1);
10717  __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 666, __pyx_L1_error)
10718  __Pyx_GOTREF(__pyx_t_17);
10719  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10720  __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_arg_shape_copy, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 666, __pyx_L1_error)
10721  __Pyx_GOTREF(__pyx_t_1);
10722  __pyx_t_28 = PyTuple_New(1); if (unlikely(!__pyx_t_28)) __PYX_ERR(0, 666, __pyx_L1_error)
10723  __Pyx_GOTREF(__pyx_t_28);
10724  __Pyx_GIVEREF(__pyx_t_1);
10725  PyTuple_SET_ITEM(__pyx_t_28, 0, __pyx_t_1);
10726  __pyx_t_1 = 0;
10727  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 666, __pyx_L1_error)
10728  __Pyx_GOTREF(__pyx_t_1);
10729  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 666, __pyx_L1_error)
10730  __Pyx_GOTREF(__pyx_t_2);
10731  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_double); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 666, __pyx_L1_error)
10732  __Pyx_GOTREF(__pyx_t_5);
10733  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10734  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 666, __pyx_L1_error)
10735  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10736  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_28, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 666, __pyx_L1_error)
10737  __Pyx_GOTREF(__pyx_t_5);
10738  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
10739  __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0;
10740  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10741  __pyx_v_arg_2doArray = __pyx_t_5;
10742  __pyx_t_5 = 0;
10743 
10744  /* "mprans/MeshSmoothing.pyx":667
10745  * arg_shape_copy[0] = nNodes_global-nNodes_owned
10746  * arg_2doArray = np.zeros(arg_shape_copy, dtype=np.double)
10747  * for rank_recv in range(comm_size): # <<<<<<<<<<<<<<
10748  * arg_2rank_values = arg_2rank[rank_recv].astype(np.double)
10749  * if arg_shape_len > 1:
10750  */
10751  __pyx_t_7 = __pyx_cur_scope->__pyx_v_comm_size;
10752  __pyx_t_10 = __pyx_t_7;
10753  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_10; __pyx_t_13+=1) {
10754  __pyx_v_rank_recv = __pyx_t_13;
10755 
10756  /* "mprans/MeshSmoothing.pyx":668
10757  * arg_2doArray = np.zeros(arg_shape_copy, dtype=np.double)
10758  * for rank_recv in range(comm_size):
10759  * arg_2rank_values = arg_2rank[rank_recv].astype(np.double) # <<<<<<<<<<<<<<
10760  * if arg_shape_len > 1:
10761  * datatype = MPI.DOUBLE.Create_contiguous(shape_factor).Commit()
10762  */
10763  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rank_recv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 668, __pyx_L1_error)
10764  __Pyx_GOTREF(__pyx_t_1);
10765  __pyx_t_28 = __Pyx_PyDict_GetItem(__pyx_v_arg_2rank, __pyx_t_1); if (unlikely(!__pyx_t_28)) __PYX_ERR(0, 668, __pyx_L1_error)
10766  __Pyx_GOTREF(__pyx_t_28);
10767  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10768  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_28, __pyx_n_s_astype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 668, __pyx_L1_error)
10769  __Pyx_GOTREF(__pyx_t_1);
10770  __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0;
10771  __Pyx_GetModuleGlobalName(__pyx_t_28, __pyx_n_s_np); if (unlikely(!__pyx_t_28)) __PYX_ERR(0, 668, __pyx_L1_error)
10772  __Pyx_GOTREF(__pyx_t_28);
10773  __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_28, __pyx_n_s_double); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 668, __pyx_L1_error)
10774  __Pyx_GOTREF(__pyx_t_17);
10775  __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0;
10776  __pyx_t_28 = NULL;
10777  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
10778  __pyx_t_28 = PyMethod_GET_SELF(__pyx_t_1);
10779  if (likely(__pyx_t_28)) {
10780  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
10781  __Pyx_INCREF(__pyx_t_28);
10782  __Pyx_INCREF(function);
10783  __Pyx_DECREF_SET(__pyx_t_1, function);
10784  }
10785  }
10786  __pyx_t_5 = (__pyx_t_28) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_28, __pyx_t_17) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_17);
10787  __Pyx_XDECREF(__pyx_t_28); __pyx_t_28 = 0;
10788  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
10789  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 668, __pyx_L1_error)
10790  __Pyx_GOTREF(__pyx_t_5);
10791  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10792  __Pyx_XDECREF_SET(__pyx_v_arg_2rank_values, __pyx_t_5);
10793  __pyx_t_5 = 0;
10794 
10795  /* "mprans/MeshSmoothing.pyx":669
10796  * for rank_recv in range(comm_size):
10797  * arg_2rank_values = arg_2rank[rank_recv].astype(np.double)
10798  * if arg_shape_len > 1: # <<<<<<<<<<<<<<
10799  * datatype = MPI.DOUBLE.Create_contiguous(shape_factor).Commit()
10800  * else:
10801  */
10802  __pyx_t_9 = ((__pyx_v_arg_shape_len > 1) != 0);
10803  if (__pyx_t_9) {
10804 
10805  /* "mprans/MeshSmoothing.pyx":670
10806  * arg_2rank_values = arg_2rank[rank_recv].astype(np.double)
10807  * if arg_shape_len > 1:
10808  * datatype = MPI.DOUBLE.Create_contiguous(shape_factor).Commit() # <<<<<<<<<<<<<<
10809  * else:
10810  * datatype = MPI.DOUBLE
10811  */
10812  __Pyx_GetModuleGlobalName(__pyx_t_17, __pyx_n_s_MPI); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 670, __pyx_L1_error)
10813  __Pyx_GOTREF(__pyx_t_17);
10814  __pyx_t_28 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_DOUBLE); if (unlikely(!__pyx_t_28)) __PYX_ERR(0, 670, __pyx_L1_error)
10815  __Pyx_GOTREF(__pyx_t_28);
10816  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
10817  __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_28, __pyx_n_s_Create_contiguous); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 670, __pyx_L1_error)
10818  __Pyx_GOTREF(__pyx_t_17);
10819  __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0;
10820  __pyx_t_28 = __Pyx_PyInt_From_int(__pyx_v_shape_factor); if (unlikely(!__pyx_t_28)) __PYX_ERR(0, 670, __pyx_L1_error)
10821  __Pyx_GOTREF(__pyx_t_28);
10822  __pyx_t_2 = NULL;
10823  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_17))) {
10824  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_17);
10825  if (likely(__pyx_t_2)) {
10826  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
10827  __Pyx_INCREF(__pyx_t_2);
10828  __Pyx_INCREF(function);
10829  __Pyx_DECREF_SET(__pyx_t_17, function);
10830  }
10831  }
10832  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_17, __pyx_t_2, __pyx_t_28) : __Pyx_PyObject_CallOneArg(__pyx_t_17, __pyx_t_28);
10833  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
10834  __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0;
10835  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 670, __pyx_L1_error)
10836  __Pyx_GOTREF(__pyx_t_1);
10837  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
10838  __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Commit); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 670, __pyx_L1_error)
10839  __Pyx_GOTREF(__pyx_t_17);
10840  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10841  __pyx_t_1 = NULL;
10842  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_17))) {
10843  __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_17);
10844  if (likely(__pyx_t_1)) {
10845  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
10846  __Pyx_INCREF(__pyx_t_1);
10847  __Pyx_INCREF(function);
10848  __Pyx_DECREF_SET(__pyx_t_17, function);
10849  }
10850  }
10851  __pyx_t_5 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_17, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_17);
10852  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
10853  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 670, __pyx_L1_error)
10854  __Pyx_GOTREF(__pyx_t_5);
10855  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
10856  __Pyx_XDECREF_SET(__pyx_v_datatype, __pyx_t_5);
10857  __pyx_t_5 = 0;
10858 
10859  /* "mprans/MeshSmoothing.pyx":669
10860  * for rank_recv in range(comm_size):
10861  * arg_2rank_values = arg_2rank[rank_recv].astype(np.double)
10862  * if arg_shape_len > 1: # <<<<<<<<<<<<<<
10863  * datatype = MPI.DOUBLE.Create_contiguous(shape_factor).Commit()
10864  * else:
10865  */
10866  goto __pyx_L31;
10867  }
10868 
10869  /* "mprans/MeshSmoothing.pyx":672
10870  * datatype = MPI.DOUBLE.Create_contiguous(shape_factor).Commit()
10871  * else:
10872  * datatype = MPI.DOUBLE # <<<<<<<<<<<<<<
10873  * comm.Gatherv(arg_2rank_values,
10874  * [arg_2doArray,
10875  */
10876  /*else*/ {
10877  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_MPI); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 672, __pyx_L1_error)
10878  __Pyx_GOTREF(__pyx_t_5);
10879  __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_DOUBLE); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 672, __pyx_L1_error)
10880  __Pyx_GOTREF(__pyx_t_17);
10881  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10882  __Pyx_XDECREF_SET(__pyx_v_datatype, __pyx_t_17);
10883  __pyx_t_17 = 0;
10884  }
10885  __pyx_L31:;
10886 
10887  /* "mprans/MeshSmoothing.pyx":673
10888  * else:
10889  * datatype = MPI.DOUBLE
10890  * comm.Gatherv(arg_2rank_values, # <<<<<<<<<<<<<<
10891  * [arg_2doArray,
10892  * counts_out,
10893  */
10894  __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_comm, __pyx_n_s_Gatherv); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 673, __pyx_L1_error)
10895  __Pyx_GOTREF(__pyx_t_17);
10896 
10897  /* "mprans/MeshSmoothing.pyx":675
10898  * comm.Gatherv(arg_2rank_values,
10899  * [arg_2doArray,
10900  * counts_out, # <<<<<<<<<<<<<<
10901  * displacements_out,
10902  * datatype],
10903  */
10904  __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_counts_out, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 675, __pyx_L1_error)
10905  __Pyx_GOTREF(__pyx_t_5);
10906 
10907  /* "mprans/MeshSmoothing.pyx":676
10908  * [arg_2doArray,
10909  * counts_out,
10910  * displacements_out, # <<<<<<<<<<<<<<
10911  * datatype],
10912  * root=rank_recv)
10913  */
10914  __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_displacements_out, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 676, __pyx_L1_error)
10915  __Pyx_GOTREF(__pyx_t_1);
10916 
10917  /* "mprans/MeshSmoothing.pyx":674
10918  * datatype = MPI.DOUBLE
10919  * comm.Gatherv(arg_2rank_values,
10920  * [arg_2doArray, # <<<<<<<<<<<<<<
10921  * counts_out,
10922  * displacements_out,
10923  */
10924  __pyx_t_28 = PyList_New(4); if (unlikely(!__pyx_t_28)) __PYX_ERR(0, 674, __pyx_L1_error)
10925  __Pyx_GOTREF(__pyx_t_28);
10926  __Pyx_INCREF(__pyx_v_arg_2doArray);
10927  __Pyx_GIVEREF(__pyx_v_arg_2doArray);
10928  PyList_SET_ITEM(__pyx_t_28, 0, __pyx_v_arg_2doArray);
10929  __Pyx_GIVEREF(__pyx_t_5);
10930  PyList_SET_ITEM(__pyx_t_28, 1, __pyx_t_5);
10931  __Pyx_GIVEREF(__pyx_t_1);
10932  PyList_SET_ITEM(__pyx_t_28, 2, __pyx_t_1);
10933  __Pyx_INCREF(__pyx_v_datatype);
10934  __Pyx_GIVEREF(__pyx_v_datatype);
10935  PyList_SET_ITEM(__pyx_t_28, 3, __pyx_v_datatype);
10936  __pyx_t_5 = 0;
10937  __pyx_t_1 = 0;
10938 
10939  /* "mprans/MeshSmoothing.pyx":673
10940  * else:
10941  * datatype = MPI.DOUBLE
10942  * comm.Gatherv(arg_2rank_values, # <<<<<<<<<<<<<<
10943  * [arg_2doArray,
10944  * counts_out,
10945  */
10946  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 673, __pyx_L1_error)
10947  __Pyx_GOTREF(__pyx_t_1);
10948  __Pyx_INCREF(__pyx_v_arg_2rank_values);
10949  __Pyx_GIVEREF(__pyx_v_arg_2rank_values);
10950  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_arg_2rank_values);
10951  __Pyx_GIVEREF(__pyx_t_28);
10952  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_28);
10953  __pyx_t_28 = 0;
10954 
10955  /* "mprans/MeshSmoothing.pyx":678
10956  * displacements_out,
10957  * datatype],
10958  * root=rank_recv) # <<<<<<<<<<<<<<
10959  * # FINALLY APPLY FINAL POSITION OF NON-OWNED NODES
10960  * for iN in range(nNodes_owned, nNodes_global):
10961  */
10962  __pyx_t_28 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_28)) __PYX_ERR(0, 678, __pyx_L1_error)
10963  __Pyx_GOTREF(__pyx_t_28);
10964  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_rank_recv); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 678, __pyx_L1_error)
10965  __Pyx_GOTREF(__pyx_t_5);
10966  if (PyDict_SetItem(__pyx_t_28, __pyx_n_s_root, __pyx_t_5) < 0) __PYX_ERR(0, 678, __pyx_L1_error)
10967  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10968 
10969  /* "mprans/MeshSmoothing.pyx":673
10970  * else:
10971  * datatype = MPI.DOUBLE
10972  * comm.Gatherv(arg_2rank_values, # <<<<<<<<<<<<<<
10973  * [arg_2doArray,
10974  * counts_out,
10975  */
10976  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_1, __pyx_t_28); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 673, __pyx_L1_error)
10977  __Pyx_GOTREF(__pyx_t_5);
10978  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
10979  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10980  __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0;
10981  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10982  }
10983 
10984  /* "mprans/MeshSmoothing.pyx":680
10985  * root=rank_recv)
10986  * # FINALLY APPLY FINAL POSITION OF NON-OWNED NODES
10987  * for iN in range(nNodes_owned, nNodes_global): # <<<<<<<<<<<<<<
10988  * if arg_shape_len > 1:
10989  * for ii in range(arg_shape[1]):
10990  */
10991  __pyx_t_7 = __pyx_v_nNodes_global;
10992  __pyx_t_10 = __pyx_t_7;
10993  for (__pyx_t_13 = __pyx_v_nNodes_owned; __pyx_t_13 < __pyx_t_10; __pyx_t_13+=1) {
10994  __pyx_v_iN = __pyx_t_13;
10995 
10996  /* "mprans/MeshSmoothing.pyx":681
10997  * # FINALLY APPLY FINAL POSITION OF NON-OWNED NODES
10998  * for iN in range(nNodes_owned, nNodes_global):
10999  * if arg_shape_len > 1: # <<<<<<<<<<<<<<
11000  * for ii in range(arg_shape[1]):
11001  * args_[iN, ii] = arg_2doArray[iN-nNodes_owned, ii]
11002  */
11003  __pyx_t_9 = ((__pyx_v_arg_shape_len > 1) != 0);
11004  if (__pyx_t_9) {
11005 
11006  /* "mprans/MeshSmoothing.pyx":682
11007  * for iN in range(nNodes_owned, nNodes_global):
11008  * if arg_shape_len > 1:
11009  * for ii in range(arg_shape[1]): # <<<<<<<<<<<<<<
11010  * args_[iN, ii] = arg_2doArray[iN-nNodes_owned, ii]
11011  * else:
11012  */
11013  __pyx_t_41 = 1;
11014  if (__pyx_t_41 < 0) __pyx_t_41 += __pyx_v_arg_shape.shape[0];
11015  __pyx_t_16 = (*((int *) ( /* dim=0 */ (__pyx_v_arg_shape.data + __pyx_t_41 * __pyx_v_arg_shape.strides[0]) )));
11016  __pyx_t_22 = __pyx_t_16;
11017  for (__pyx_t_23 = 0; __pyx_t_23 < __pyx_t_22; __pyx_t_23+=1) {
11018  __pyx_v_ii = __pyx_t_23;
11019 
11020  /* "mprans/MeshSmoothing.pyx":683
11021  * if arg_shape_len > 1:
11022  * for ii in range(arg_shape[1]):
11023  * args_[iN, ii] = arg_2doArray[iN-nNodes_owned, ii] # <<<<<<<<<<<<<<
11024  * else:
11025  * args_[iN] = arg_2doArray[iN-nNodes_owned]
11026  */
11027  __pyx_t_5 = __Pyx_PyInt_From_int((__pyx_v_iN - __pyx_v_nNodes_owned)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 683, __pyx_L1_error)
11028  __Pyx_GOTREF(__pyx_t_5);
11029  __pyx_t_28 = __Pyx_PyInt_From_int(__pyx_v_ii); if (unlikely(!__pyx_t_28)) __PYX_ERR(0, 683, __pyx_L1_error)
11030  __Pyx_GOTREF(__pyx_t_28);
11031  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 683, __pyx_L1_error)
11032  __Pyx_GOTREF(__pyx_t_1);
11033  __Pyx_GIVEREF(__pyx_t_5);
11034  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
11035  __Pyx_GIVEREF(__pyx_t_28);
11036  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_28);
11037  __pyx_t_5 = 0;
11038  __pyx_t_28 = 0;
11039  __pyx_t_28 = __Pyx_PyObject_GetItem(__pyx_v_arg_2doArray, __pyx_t_1); if (unlikely(!__pyx_t_28)) __PYX_ERR(0, 683, __pyx_L1_error)
11040  __Pyx_GOTREF(__pyx_t_28);
11041  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11042  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_iN); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 683, __pyx_L1_error)
11043  __Pyx_GOTREF(__pyx_t_1);
11044  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_ii); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 683, __pyx_L1_error)
11045  __Pyx_GOTREF(__pyx_t_5);
11046  __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 683, __pyx_L1_error)
11047  __Pyx_GOTREF(__pyx_t_17);
11048  __Pyx_GIVEREF(__pyx_t_1);
11049  PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_1);
11050  __Pyx_GIVEREF(__pyx_t_5);
11051  PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_5);
11052  __pyx_t_1 = 0;
11053  __pyx_t_5 = 0;
11054  if (unlikely(PyObject_SetItem(__pyx_v_args_, __pyx_t_17, __pyx_t_28) < 0)) __PYX_ERR(0, 683, __pyx_L1_error)
11055  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
11056  __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0;
11057  }
11058 
11059  /* "mprans/MeshSmoothing.pyx":681
11060  * # FINALLY APPLY FINAL POSITION OF NON-OWNED NODES
11061  * for iN in range(nNodes_owned, nNodes_global):
11062  * if arg_shape_len > 1: # <<<<<<<<<<<<<<
11063  * for ii in range(arg_shape[1]):
11064  * args_[iN, ii] = arg_2doArray[iN-nNodes_owned, ii]
11065  */
11066  goto __pyx_L34;
11067  }
11068 
11069  /* "mprans/MeshSmoothing.pyx":685
11070  * args_[iN, ii] = arg_2doArray[iN-nNodes_owned, ii]
11071  * else:
11072  * args_[iN] = arg_2doArray[iN-nNodes_owned] # <<<<<<<<<<<<<<
11073  * # logEvent('Non-owned values recovered with {comm_total} communication steps ({comm_pp}*{nproc})'.format(comm_total=str(comm_size*4),
11074  * # comm_pp=str(4),
11075  */
11076  /*else*/ {
11077  __pyx_t_16 = (__pyx_v_iN - __pyx_v_nNodes_owned);
11078  __pyx_t_28 = __Pyx_GetItemInt(__pyx_v_arg_2doArray, __pyx_t_16, int, 1, __Pyx_PyInt_From_int, 0, 1, 0); if (unlikely(!__pyx_t_28)) __PYX_ERR(0, 685, __pyx_L1_error)
11079  __Pyx_GOTREF(__pyx_t_28);
11080  if (unlikely(__Pyx_SetItemInt(__pyx_v_args_, __pyx_v_iN, __pyx_t_28, int, 1, __Pyx_PyInt_From_int, 0, 1, 0) < 0)) __PYX_ERR(0, 685, __pyx_L1_error)
11081  __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0;
11082  }
11083  __pyx_L34:;
11084  }
11085 
11086  /* "mprans/MeshSmoothing.pyx":592
11087  * for i in range(1, arg_shape_len):
11088  * shape_factor = shape_factor*arg_shape[i]
11089  * if comm_size > 1: # <<<<<<<<<<<<<<
11090  * for rank in range(comm_size):
11091  * nodes_2rank[rank] = np.zeros(0, dtype=np.int32)
11092  */
11093  }
11094 
11095  /* "mprans/MeshSmoothing.pyx":559
11096  * nNodes=nNodes)
11097  *
11098  * def getNonOwnedNodeValues(args_, # <<<<<<<<<<<<<<
11099  * int nNodes_owned,
11100  * int nNodes_global,
11101  */
11102 
11103  /* function exit code */
11104  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11105  goto __pyx_L0;
11106  __pyx_L1_error:;
11107  __Pyx_XDECREF(__pyx_t_1);
11108  __Pyx_XDECREF(__pyx_t_2);
11109  __Pyx_XDECREF(__pyx_t_3);
11110  __Pyx_XDECREF(__pyx_t_4);
11111  __Pyx_XDECREF(__pyx_t_5);
11112  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
11113  __Pyx_XDECREF(__pyx_t_17);
11114  __Pyx_XDECREF(__pyx_t_28);
11115  __Pyx_AddTraceback("mprans.MeshSmoothing.getNonOwnedNodeValues", __pyx_clineno, __pyx_lineno, __pyx_filename);
11116  __pyx_r = NULL;
11117  __pyx_L0:;
11118  __Pyx_XDECREF(__pyx_v_Comm);
11119  __Pyx_XDECREF(__pyx_v_comm);
11120  __Pyx_XDECREF(__pyx_v_arg_2rank);
11121  __Pyx_XDECREF(__pyx_v_nodes_2rank);
11122  __PYX_XDEC_MEMVIEW(&__pyx_v_result, 1);
11123  __PYX_XDEC_MEMVIEW(&__pyx_v_counts_in, 1);
11124  __PYX_XDEC_MEMVIEW(&__pyx_v_displacements_in, 1);
11125  __PYX_XDEC_MEMVIEW(&__pyx_v_counts_out, 1);
11126  __PYX_XDEC_MEMVIEW(&__pyx_v_displacements_out, 1);
11127  __PYX_XDEC_MEMVIEW(&__pyx_v_arg_shape, 1);
11128  __PYX_XDEC_MEMVIEW(&__pyx_v_arg_shape_copy, 1);
11129  __PYX_XDEC_MEMVIEW(&__pyx_v_nodes_2rank_values, 1);
11130  __PYX_XDEC_MEMVIEW(&__pyx_v_nodes_2doArray, 1);
11131  __Pyx_XDECREF(__pyx_v_array_size);
11132  __Pyx_XDECREF(__pyx_v_my_size);
11133  __Pyx_XDECREF(__pyx_v_arg_2rank_values);
11134  __Pyx_XDECREF(__pyx_v_arg_2doArray);
11135  __Pyx_XDECREF(__pyx_v_datatype);
11136  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeNumbering_subdomain2global, 1);
11137  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeOffsets_subdomain_owned, 1);
11138  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
11139  __Pyx_XGIVEREF(__pyx_r);
11140  __Pyx_RefNannyFinishContext();
11141  return __pyx_r;
11142 }
11143 
11144 /* "mprans/MeshSmoothing.pyx":690
11145  * # nproc=str(comm_size)))
11146  *
11147  * def checkOwnedVariable(int variable_nb_local, # <<<<<<<<<<<<<<
11148  * int rank,
11149  * int nVariables_owned,
11150  */
11151 
11152 /* Python wrapper */
11153 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_55checkOwnedVariable(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
11154 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_55checkOwnedVariable = {"checkOwnedVariable", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_55checkOwnedVariable, METH_VARARGS|METH_KEYWORDS, 0};
11155 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_55checkOwnedVariable(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
11156  int __pyx_v_variable_nb_local;
11157  int __pyx_v_rank;
11158  int __pyx_v_nVariables_owned;
11159  __Pyx_memviewslice __pyx_v_variableNumbering_subdomain2global = { 0, 0, { 0 }, { 0 }, { 0 } };
11160  __Pyx_memviewslice __pyx_v_variableOffsets_subdomain_owned = { 0, 0, { 0 }, { 0 }, { 0 } };
11161  PyObject *__pyx_r = 0;
11162  __Pyx_RefNannyDeclarations
11163  __Pyx_RefNannySetupContext("checkOwnedVariable (wrapper)", 0);
11164  {
11165  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_variable_nb_local,&__pyx_n_s_rank,&__pyx_n_s_nVariables_owned,&__pyx_n_s_variableNumbering_subdomain2glob,&__pyx_n_s_variableOffsets_subdomain_owned,0};
11166  PyObject* values[5] = {0,0,0,0,0};
11167  if (unlikely(__pyx_kwds)) {
11168  Py_ssize_t kw_args;
11169  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
11170  switch (pos_args) {
11171  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
11172  CYTHON_FALLTHROUGH;
11173  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11174  CYTHON_FALLTHROUGH;
11175  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11176  CYTHON_FALLTHROUGH;
11177  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11178  CYTHON_FALLTHROUGH;
11179  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11180  CYTHON_FALLTHROUGH;
11181  case 0: break;
11182  default: goto __pyx_L5_argtuple_error;
11183  }
11184  kw_args = PyDict_Size(__pyx_kwds);
11185  switch (pos_args) {
11186  case 0:
11187  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_variable_nb_local)) != 0)) kw_args--;
11188  else goto __pyx_L5_argtuple_error;
11189  CYTHON_FALLTHROUGH;
11190  case 1:
11191  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rank)) != 0)) kw_args--;
11192  else {
11193  __Pyx_RaiseArgtupleInvalid("checkOwnedVariable", 1, 5, 5, 1); __PYX_ERR(0, 690, __pyx_L3_error)
11194  }
11195  CYTHON_FALLTHROUGH;
11196  case 2:
11197  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nVariables_owned)) != 0)) kw_args--;
11198  else {
11199  __Pyx_RaiseArgtupleInvalid("checkOwnedVariable", 1, 5, 5, 2); __PYX_ERR(0, 690, __pyx_L3_error)
11200  }
11201  CYTHON_FALLTHROUGH;
11202  case 3:
11203  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_variableNumbering_subdomain2glob)) != 0)) kw_args--;
11204  else {
11205  __Pyx_RaiseArgtupleInvalid("checkOwnedVariable", 1, 5, 5, 3); __PYX_ERR(0, 690, __pyx_L3_error)
11206  }
11207  CYTHON_FALLTHROUGH;
11208  case 4:
11209  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_variableOffsets_subdomain_owned)) != 0)) kw_args--;
11210  else {
11211  __Pyx_RaiseArgtupleInvalid("checkOwnedVariable", 1, 5, 5, 4); __PYX_ERR(0, 690, __pyx_L3_error)
11212  }
11213  }
11214  if (unlikely(kw_args > 0)) {
11215  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "checkOwnedVariable") < 0)) __PYX_ERR(0, 690, __pyx_L3_error)
11216  }
11217  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
11218  goto __pyx_L5_argtuple_error;
11219  } else {
11220  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11221  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11222  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11223  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11224  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
11225  }
11226  __pyx_v_variable_nb_local = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_variable_nb_local == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 690, __pyx_L3_error)
11227  __pyx_v_rank = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_rank == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L3_error)
11228  __pyx_v_nVariables_owned = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_nVariables_owned == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 692, __pyx_L3_error)
11229  __pyx_v_variableNumbering_subdomain2global = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_variableNumbering_subdomain2global.memview)) __PYX_ERR(0, 693, __pyx_L3_error)
11230  __pyx_v_variableOffsets_subdomain_owned = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_variableOffsets_subdomain_owned.memview)) __PYX_ERR(0, 694, __pyx_L3_error)
11231  }
11232  goto __pyx_L4_argument_unpacking_done;
11233  __pyx_L5_argtuple_error:;
11234  __Pyx_RaiseArgtupleInvalid("checkOwnedVariable", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 690, __pyx_L3_error)
11235  __pyx_L3_error:;
11236  __Pyx_AddTraceback("mprans.MeshSmoothing.checkOwnedVariable", __pyx_clineno, __pyx_lineno, __pyx_filename);
11237  __Pyx_RefNannyFinishContext();
11238  return NULL;
11239  __pyx_L4_argument_unpacking_done:;
11240  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_54checkOwnedVariable(__pyx_self, __pyx_v_variable_nb_local, __pyx_v_rank, __pyx_v_nVariables_owned, __pyx_v_variableNumbering_subdomain2global, __pyx_v_variableOffsets_subdomain_owned);
11241 
11242  /* function exit code */
11243  __Pyx_RefNannyFinishContext();
11244  return __pyx_r;
11245 }
11246 
11247 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_54checkOwnedVariable(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_variable_nb_local, int __pyx_v_rank, int __pyx_v_nVariables_owned, __Pyx_memviewslice __pyx_v_variableNumbering_subdomain2global, __Pyx_memviewslice __pyx_v_variableOffsets_subdomain_owned) {
11248  PyObject *__pyx_r = NULL;
11249  __Pyx_RefNannyDeclarations
11250  __Pyx_memviewslice __pyx_t_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
11251  PyObject *__pyx_t_2 = NULL;
11252  __Pyx_RefNannySetupContext("checkOwnedVariable", 0);
11253 
11254  /* "mprans/MeshSmoothing.pyx":695
11255  * int[:] variableNumbering_subdomain2global,
11256  * int[:] variableOffsets_subdomain_owned):
11257  * return cyCheckOwnedVariable(variable_nb_local=variable_nb_local, # <<<<<<<<<<<<<<
11258  * rank=rank,
11259  * nVariables_owned=nVariables_owned,
11260  */
11261  __Pyx_XDECREF(__pyx_r);
11262 
11263  /* "mprans/MeshSmoothing.pyx":699
11264  * nVariables_owned=nVariables_owned,
11265  * variableNumbering_subdomain2global=variableNumbering_subdomain2global,
11266  * variableOffsets_subdomain_owned=variableOffsets_subdomain_owned) # <<<<<<<<<<<<<<
11267  *
11268  * def pyScalarRecoveryAtNodes(double[:] scalars,
11269  */
11270  __pyx_t_1 = __pyx_f_6mprans_13MeshSmoothing_cyCheckOwnedVariable(__pyx_v_variable_nb_local, __pyx_v_rank, __pyx_v_nVariables_owned, __pyx_v_variableNumbering_subdomain2global, __pyx_v_variableOffsets_subdomain_owned); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 695, __pyx_L1_error)
11271 
11272  /* "mprans/MeshSmoothing.pyx":695
11273  * int[:] variableNumbering_subdomain2global,
11274  * int[:] variableOffsets_subdomain_owned):
11275  * return cyCheckOwnedVariable(variable_nb_local=variable_nb_local, # <<<<<<<<<<<<<<
11276  * rank=rank,
11277  * nVariables_owned=nVariables_owned,
11278  */
11279  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_t_1, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 695, __pyx_L1_error)
11280  __Pyx_GOTREF(__pyx_t_2);
11281  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
11282  __pyx_t_1.memview = NULL;
11283  __pyx_t_1.data = NULL;
11284  __pyx_r = __pyx_t_2;
11285  __pyx_t_2 = 0;
11286  goto __pyx_L0;
11287 
11288  /* "mprans/MeshSmoothing.pyx":690
11289  * # nproc=str(comm_size)))
11290  *
11291  * def checkOwnedVariable(int variable_nb_local, # <<<<<<<<<<<<<<
11292  * int rank,
11293  * int nVariables_owned,
11294  */
11295 
11296  /* function exit code */
11297  __pyx_L1_error:;
11298  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
11299  __Pyx_XDECREF(__pyx_t_2);
11300  __Pyx_AddTraceback("mprans.MeshSmoothing.checkOwnedVariable", __pyx_clineno, __pyx_lineno, __pyx_filename);
11301  __pyx_r = NULL;
11302  __pyx_L0:;
11303  __PYX_XDEC_MEMVIEW(&__pyx_v_variableNumbering_subdomain2global, 1);
11304  __PYX_XDEC_MEMVIEW(&__pyx_v_variableOffsets_subdomain_owned, 1);
11305  __Pyx_XGIVEREF(__pyx_r);
11306  __Pyx_RefNannyFinishContext();
11307  return __pyx_r;
11308 }
11309 
11310 /* "mprans/MeshSmoothing.pyx":701
11311  * variableOffsets_subdomain_owned=variableOffsets_subdomain_owned)
11312  *
11313  * def pyScalarRecoveryAtNodes(double[:] scalars, # <<<<<<<<<<<<<<
11314  * int[:] nodeElementsArray,
11315  * int[:] nodeElementOffsets):
11316  */
11317 
11318 /* Python wrapper */
11319 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_57pyScalarRecoveryAtNodes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
11320 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_57pyScalarRecoveryAtNodes = {"pyScalarRecoveryAtNodes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_57pyScalarRecoveryAtNodes, METH_VARARGS|METH_KEYWORDS, 0};
11321 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_57pyScalarRecoveryAtNodes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
11322  __Pyx_memviewslice __pyx_v_scalars = { 0, 0, { 0 }, { 0 }, { 0 } };
11323  __Pyx_memviewslice __pyx_v_nodeElementsArray = { 0, 0, { 0 }, { 0 }, { 0 } };
11324  __Pyx_memviewslice __pyx_v_nodeElementOffsets = { 0, 0, { 0 }, { 0 }, { 0 } };
11325  PyObject *__pyx_r = 0;
11326  __Pyx_RefNannyDeclarations
11327  __Pyx_RefNannySetupContext("pyScalarRecoveryAtNodes (wrapper)", 0);
11328  {
11329  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_scalars,&__pyx_n_s_nodeElementsArray,&__pyx_n_s_nodeElementOffsets,0};
11330  PyObject* values[3] = {0,0,0};
11331  if (unlikely(__pyx_kwds)) {
11332  Py_ssize_t kw_args;
11333  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
11334  switch (pos_args) {
11335  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11336  CYTHON_FALLTHROUGH;
11337  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11338  CYTHON_FALLTHROUGH;
11339  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11340  CYTHON_FALLTHROUGH;
11341  case 0: break;
11342  default: goto __pyx_L5_argtuple_error;
11343  }
11344  kw_args = PyDict_Size(__pyx_kwds);
11345  switch (pos_args) {
11346  case 0:
11347  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_scalars)) != 0)) kw_args--;
11348  else goto __pyx_L5_argtuple_error;
11349  CYTHON_FALLTHROUGH;
11350  case 1:
11351  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementsArray)) != 0)) kw_args--;
11352  else {
11353  __Pyx_RaiseArgtupleInvalid("pyScalarRecoveryAtNodes", 1, 3, 3, 1); __PYX_ERR(0, 701, __pyx_L3_error)
11354  }
11355  CYTHON_FALLTHROUGH;
11356  case 2:
11357  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementOffsets)) != 0)) kw_args--;
11358  else {
11359  __Pyx_RaiseArgtupleInvalid("pyScalarRecoveryAtNodes", 1, 3, 3, 2); __PYX_ERR(0, 701, __pyx_L3_error)
11360  }
11361  }
11362  if (unlikely(kw_args > 0)) {
11363  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pyScalarRecoveryAtNodes") < 0)) __PYX_ERR(0, 701, __pyx_L3_error)
11364  }
11365  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
11366  goto __pyx_L5_argtuple_error;
11367  } else {
11368  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11369  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11370  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11371  }
11372  __pyx_v_scalars = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_scalars.memview)) __PYX_ERR(0, 701, __pyx_L3_error)
11373  __pyx_v_nodeElementsArray = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementsArray.memview)) __PYX_ERR(0, 702, __pyx_L3_error)
11374  __pyx_v_nodeElementOffsets = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementOffsets.memview)) __PYX_ERR(0, 703, __pyx_L3_error)
11375  }
11376  goto __pyx_L4_argument_unpacking_done;
11377  __pyx_L5_argtuple_error:;
11378  __Pyx_RaiseArgtupleInvalid("pyScalarRecoveryAtNodes", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 701, __pyx_L3_error)
11379  __pyx_L3_error:;
11380  __Pyx_AddTraceback("mprans.MeshSmoothing.pyScalarRecoveryAtNodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
11381  __Pyx_RefNannyFinishContext();
11382  return NULL;
11383  __pyx_L4_argument_unpacking_done:;
11384  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_56pyScalarRecoveryAtNodes(__pyx_self, __pyx_v_scalars, __pyx_v_nodeElementsArray, __pyx_v_nodeElementOffsets);
11385 
11386  /* function exit code */
11387  __Pyx_RefNannyFinishContext();
11388  return __pyx_r;
11389 }
11390 
11391 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_56pyScalarRecoveryAtNodes(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_scalars, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets) {
11392  PyObject *__pyx_r = NULL;
11393  __Pyx_RefNannyDeclarations
11394  __Pyx_memviewslice __pyx_t_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
11395  PyObject *__pyx_t_2 = NULL;
11396  __Pyx_RefNannySetupContext("pyScalarRecoveryAtNodes", 0);
11397 
11398  /* "mprans/MeshSmoothing.pyx":704
11399  * int[:] nodeElementsArray,
11400  * int[:] nodeElementOffsets):
11401  * return cyScalarRecoveryAtNodes(scalars=scalars, # <<<<<<<<<<<<<<
11402  * nodeElementsArray=nodeElementsArray,
11403  * nodeElementOffsets=nodeElementOffsets)
11404  */
11405  __Pyx_XDECREF(__pyx_r);
11406 
11407  /* "mprans/MeshSmoothing.pyx":706
11408  * return cyScalarRecoveryAtNodes(scalars=scalars,
11409  * nodeElementsArray=nodeElementsArray,
11410  * nodeElementOffsets=nodeElementOffsets) # <<<<<<<<<<<<<<
11411  *
11412  * def pyScalarRecoveryAtNodesWeighted(double[:] scalars,
11413  */
11414  __pyx_t_1 = __pyx_f_6mprans_13MeshSmoothing_cyScalarRecoveryAtNodes(__pyx_v_scalars, __pyx_v_nodeElementsArray, __pyx_v_nodeElementOffsets); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 704, __pyx_L1_error)
11415 
11416  /* "mprans/MeshSmoothing.pyx":704
11417  * int[:] nodeElementsArray,
11418  * int[:] nodeElementOffsets):
11419  * return cyScalarRecoveryAtNodes(scalars=scalars, # <<<<<<<<<<<<<<
11420  * nodeElementsArray=nodeElementsArray,
11421  * nodeElementOffsets=nodeElementOffsets)
11422  */
11423  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_t_1, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 704, __pyx_L1_error)
11424  __Pyx_GOTREF(__pyx_t_2);
11425  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
11426  __pyx_t_1.memview = NULL;
11427  __pyx_t_1.data = NULL;
11428  __pyx_r = __pyx_t_2;
11429  __pyx_t_2 = 0;
11430  goto __pyx_L0;
11431 
11432  /* "mprans/MeshSmoothing.pyx":701
11433  * variableOffsets_subdomain_owned=variableOffsets_subdomain_owned)
11434  *
11435  * def pyScalarRecoveryAtNodes(double[:] scalars, # <<<<<<<<<<<<<<
11436  * int[:] nodeElementsArray,
11437  * int[:] nodeElementOffsets):
11438  */
11439 
11440  /* function exit code */
11441  __pyx_L1_error:;
11442  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
11443  __Pyx_XDECREF(__pyx_t_2);
11444  __Pyx_AddTraceback("mprans.MeshSmoothing.pyScalarRecoveryAtNodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
11445  __pyx_r = NULL;
11446  __pyx_L0:;
11447  __PYX_XDEC_MEMVIEW(&__pyx_v_scalars, 1);
11448  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementsArray, 1);
11449  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementOffsets, 1);
11450  __Pyx_XGIVEREF(__pyx_r);
11451  __Pyx_RefNannyFinishContext();
11452  return __pyx_r;
11453 }
11454 
11455 /* "mprans/MeshSmoothing.pyx":708
11456  * nodeElementOffsets=nodeElementOffsets)
11457  *
11458  * def pyScalarRecoveryAtNodesWeighted(double[:] scalars, # <<<<<<<<<<<<<<
11459  * int[:] nodeElementsArray,
11460  * int[:] nodeElementOffsets,
11461  */
11462 
11463 /* Python wrapper */
11464 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_59pyScalarRecoveryAtNodesWeighted(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
11465 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_59pyScalarRecoveryAtNodesWeighted = {"pyScalarRecoveryAtNodesWeighted", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_59pyScalarRecoveryAtNodesWeighted, METH_VARARGS|METH_KEYWORDS, 0};
11466 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_59pyScalarRecoveryAtNodesWeighted(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
11467  __Pyx_memviewslice __pyx_v_scalars = { 0, 0, { 0 }, { 0 }, { 0 } };
11468  __Pyx_memviewslice __pyx_v_nodeElementsArray = { 0, 0, { 0 }, { 0 }, { 0 } };
11469  __Pyx_memviewslice __pyx_v_nodeElementOffsets = { 0, 0, { 0 }, { 0 }, { 0 } };
11470  __Pyx_memviewslice __pyx_v_detJ_array = { 0, 0, { 0 }, { 0 }, { 0 } };
11471  int __pyx_v_nNodes;
11472  PyObject *__pyx_r = 0;
11473  __Pyx_RefNannyDeclarations
11474  __Pyx_RefNannySetupContext("pyScalarRecoveryAtNodesWeighted (wrapper)", 0);
11475  {
11476  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_scalars,&__pyx_n_s_nodeElementsArray,&__pyx_n_s_nodeElementOffsets,&__pyx_n_s_detJ_array,&__pyx_n_s_nNodes,0};
11477  PyObject* values[5] = {0,0,0,0,0};
11478  if (unlikely(__pyx_kwds)) {
11479  Py_ssize_t kw_args;
11480  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
11481  switch (pos_args) {
11482  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
11483  CYTHON_FALLTHROUGH;
11484  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11485  CYTHON_FALLTHROUGH;
11486  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11487  CYTHON_FALLTHROUGH;
11488  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11489  CYTHON_FALLTHROUGH;
11490  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11491  CYTHON_FALLTHROUGH;
11492  case 0: break;
11493  default: goto __pyx_L5_argtuple_error;
11494  }
11495  kw_args = PyDict_Size(__pyx_kwds);
11496  switch (pos_args) {
11497  case 0:
11498  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_scalars)) != 0)) kw_args--;
11499  else goto __pyx_L5_argtuple_error;
11500  CYTHON_FALLTHROUGH;
11501  case 1:
11502  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementsArray)) != 0)) kw_args--;
11503  else {
11504  __Pyx_RaiseArgtupleInvalid("pyScalarRecoveryAtNodesWeighted", 1, 5, 5, 1); __PYX_ERR(0, 708, __pyx_L3_error)
11505  }
11506  CYTHON_FALLTHROUGH;
11507  case 2:
11508  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementOffsets)) != 0)) kw_args--;
11509  else {
11510  __Pyx_RaiseArgtupleInvalid("pyScalarRecoveryAtNodesWeighted", 1, 5, 5, 2); __PYX_ERR(0, 708, __pyx_L3_error)
11511  }
11512  CYTHON_FALLTHROUGH;
11513  case 3:
11514  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_detJ_array)) != 0)) kw_args--;
11515  else {
11516  __Pyx_RaiseArgtupleInvalid("pyScalarRecoveryAtNodesWeighted", 1, 5, 5, 3); __PYX_ERR(0, 708, __pyx_L3_error)
11517  }
11518  CYTHON_FALLTHROUGH;
11519  case 4:
11520  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nNodes)) != 0)) kw_args--;
11521  else {
11522  __Pyx_RaiseArgtupleInvalid("pyScalarRecoveryAtNodesWeighted", 1, 5, 5, 4); __PYX_ERR(0, 708, __pyx_L3_error)
11523  }
11524  }
11525  if (unlikely(kw_args > 0)) {
11526  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pyScalarRecoveryAtNodesWeighted") < 0)) __PYX_ERR(0, 708, __pyx_L3_error)
11527  }
11528  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
11529  goto __pyx_L5_argtuple_error;
11530  } else {
11531  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11532  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11533  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11534  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11535  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
11536  }
11537  __pyx_v_scalars = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_scalars.memview)) __PYX_ERR(0, 708, __pyx_L3_error)
11538  __pyx_v_nodeElementsArray = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementsArray.memview)) __PYX_ERR(0, 709, __pyx_L3_error)
11539  __pyx_v_nodeElementOffsets = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementOffsets.memview)) __PYX_ERR(0, 710, __pyx_L3_error)
11540  __pyx_v_detJ_array = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_detJ_array.memview)) __PYX_ERR(0, 711, __pyx_L3_error)
11541  __pyx_v_nNodes = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_nNodes == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 712, __pyx_L3_error)
11542  }
11543  goto __pyx_L4_argument_unpacking_done;
11544  __pyx_L5_argtuple_error:;
11545  __Pyx_RaiseArgtupleInvalid("pyScalarRecoveryAtNodesWeighted", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 708, __pyx_L3_error)
11546  __pyx_L3_error:;
11547  __Pyx_AddTraceback("mprans.MeshSmoothing.pyScalarRecoveryAtNodesWeighted", __pyx_clineno, __pyx_lineno, __pyx_filename);
11548  __Pyx_RefNannyFinishContext();
11549  return NULL;
11550  __pyx_L4_argument_unpacking_done:;
11551  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_58pyScalarRecoveryAtNodesWeighted(__pyx_self, __pyx_v_scalars, __pyx_v_nodeElementsArray, __pyx_v_nodeElementOffsets, __pyx_v_detJ_array, __pyx_v_nNodes);
11552 
11553  /* function exit code */
11554  __Pyx_RefNannyFinishContext();
11555  return __pyx_r;
11556 }
11557 
11558 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_58pyScalarRecoveryAtNodesWeighted(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_scalars, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_detJ_array, int __pyx_v_nNodes) {
11559  PyObject *__pyx_r = NULL;
11560  __Pyx_RefNannyDeclarations
11561  __Pyx_memviewslice __pyx_t_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
11562  PyObject *__pyx_t_2 = NULL;
11563  __Pyx_RefNannySetupContext("pyScalarRecoveryAtNodesWeighted", 0);
11564 
11565  /* "mprans/MeshSmoothing.pyx":713
11566  * double[:] detJ_array,
11567  * int nNodes):
11568  * return cyScalarRecoveryAtNodesWeighted(scalars=scalars, # <<<<<<<<<<<<<<
11569  * nodeElementsArray=nodeElementsArray,
11570  * nodeElementOffsets=nodeElementOffsets,
11571  */
11572  __Pyx_XDECREF(__pyx_r);
11573 
11574  /* "mprans/MeshSmoothing.pyx":717
11575  * nodeElementOffsets=nodeElementOffsets,
11576  * detJ_array=detJ_array,
11577  * nNodes=nNodes) # <<<<<<<<<<<<<<
11578  *
11579  * def pyVectorRecoveryAtNodes(vectors,
11580  */
11581  __pyx_t_1 = __pyx_f_6mprans_13MeshSmoothing_cyScalarRecoveryAtNodesWeighted(__pyx_v_scalars, __pyx_v_nodeElementsArray, __pyx_v_nodeElementOffsets, __pyx_v_detJ_array, __pyx_v_nNodes); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 713, __pyx_L1_error)
11582 
11583  /* "mprans/MeshSmoothing.pyx":713
11584  * double[:] detJ_array,
11585  * int nNodes):
11586  * return cyScalarRecoveryAtNodesWeighted(scalars=scalars, # <<<<<<<<<<<<<<
11587  * nodeElementsArray=nodeElementsArray,
11588  * nodeElementOffsets=nodeElementOffsets,
11589  */
11590  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_t_1, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 713, __pyx_L1_error)
11591  __Pyx_GOTREF(__pyx_t_2);
11592  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
11593  __pyx_t_1.memview = NULL;
11594  __pyx_t_1.data = NULL;
11595  __pyx_r = __pyx_t_2;
11596  __pyx_t_2 = 0;
11597  goto __pyx_L0;
11598 
11599  /* "mprans/MeshSmoothing.pyx":708
11600  * nodeElementOffsets=nodeElementOffsets)
11601  *
11602  * def pyScalarRecoveryAtNodesWeighted(double[:] scalars, # <<<<<<<<<<<<<<
11603  * int[:] nodeElementsArray,
11604  * int[:] nodeElementOffsets,
11605  */
11606 
11607  /* function exit code */
11608  __pyx_L1_error:;
11609  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
11610  __Pyx_XDECREF(__pyx_t_2);
11611  __Pyx_AddTraceback("mprans.MeshSmoothing.pyScalarRecoveryAtNodesWeighted", __pyx_clineno, __pyx_lineno, __pyx_filename);
11612  __pyx_r = NULL;
11613  __pyx_L0:;
11614  __PYX_XDEC_MEMVIEW(&__pyx_v_scalars, 1);
11615  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementsArray, 1);
11616  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementOffsets, 1);
11617  __PYX_XDEC_MEMVIEW(&__pyx_v_detJ_array, 1);
11618  __Pyx_XGIVEREF(__pyx_r);
11619  __Pyx_RefNannyFinishContext();
11620  return __pyx_r;
11621 }
11622 
11623 /* "mprans/MeshSmoothing.pyx":719
11624  * nNodes=nNodes)
11625  *
11626  * def pyVectorRecoveryAtNodes(vectors, # <<<<<<<<<<<<<<
11627  * nodeElementsArray,
11628  * nodeElementOffsets,
11629  */
11630 
11631 /* Python wrapper */
11632 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_61pyVectorRecoveryAtNodes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
11633 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_61pyVectorRecoveryAtNodes = {"pyVectorRecoveryAtNodes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_61pyVectorRecoveryAtNodes, METH_VARARGS|METH_KEYWORDS, 0};
11634 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_61pyVectorRecoveryAtNodes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
11635  PyObject *__pyx_v_vectors = 0;
11636  PyObject *__pyx_v_nodeElementsArray = 0;
11637  PyObject *__pyx_v_nodeElementOffsets = 0;
11638  PyObject *__pyx_v_nd = 0;
11639  PyObject *__pyx_r = 0;
11640  __Pyx_RefNannyDeclarations
11641  __Pyx_RefNannySetupContext("pyVectorRecoveryAtNodes (wrapper)", 0);
11642  {
11643  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vectors,&__pyx_n_s_nodeElementsArray,&__pyx_n_s_nodeElementOffsets,&__pyx_n_s_nd,0};
11644  PyObject* values[4] = {0,0,0,0};
11645  if (unlikely(__pyx_kwds)) {
11646  Py_ssize_t kw_args;
11647  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
11648  switch (pos_args) {
11649  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11650  CYTHON_FALLTHROUGH;
11651  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11652  CYTHON_FALLTHROUGH;
11653  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11654  CYTHON_FALLTHROUGH;
11655  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11656  CYTHON_FALLTHROUGH;
11657  case 0: break;
11658  default: goto __pyx_L5_argtuple_error;
11659  }
11660  kw_args = PyDict_Size(__pyx_kwds);
11661  switch (pos_args) {
11662  case 0:
11663  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vectors)) != 0)) kw_args--;
11664  else goto __pyx_L5_argtuple_error;
11665  CYTHON_FALLTHROUGH;
11666  case 1:
11667  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementsArray)) != 0)) kw_args--;
11668  else {
11669  __Pyx_RaiseArgtupleInvalid("pyVectorRecoveryAtNodes", 1, 4, 4, 1); __PYX_ERR(0, 719, __pyx_L3_error)
11670  }
11671  CYTHON_FALLTHROUGH;
11672  case 2:
11673  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementOffsets)) != 0)) kw_args--;
11674  else {
11675  __Pyx_RaiseArgtupleInvalid("pyVectorRecoveryAtNodes", 1, 4, 4, 2); __PYX_ERR(0, 719, __pyx_L3_error)
11676  }
11677  CYTHON_FALLTHROUGH;
11678  case 3:
11679  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
11680  else {
11681  __Pyx_RaiseArgtupleInvalid("pyVectorRecoveryAtNodes", 1, 4, 4, 3); __PYX_ERR(0, 719, __pyx_L3_error)
11682  }
11683  }
11684  if (unlikely(kw_args > 0)) {
11685  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pyVectorRecoveryAtNodes") < 0)) __PYX_ERR(0, 719, __pyx_L3_error)
11686  }
11687  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
11688  goto __pyx_L5_argtuple_error;
11689  } else {
11690  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11691  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11692  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11693  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11694  }
11695  __pyx_v_vectors = values[0];
11696  __pyx_v_nodeElementsArray = values[1];
11697  __pyx_v_nodeElementOffsets = values[2];
11698  __pyx_v_nd = values[3];
11699  }
11700  goto __pyx_L4_argument_unpacking_done;
11701  __pyx_L5_argtuple_error:;
11702  __Pyx_RaiseArgtupleInvalid("pyVectorRecoveryAtNodes", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 719, __pyx_L3_error)
11703  __pyx_L3_error:;
11704  __Pyx_AddTraceback("mprans.MeshSmoothing.pyVectorRecoveryAtNodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
11705  __Pyx_RefNannyFinishContext();
11706  return NULL;
11707  __pyx_L4_argument_unpacking_done:;
11708  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_60pyVectorRecoveryAtNodes(__pyx_self, __pyx_v_vectors, __pyx_v_nodeElementsArray, __pyx_v_nodeElementOffsets, __pyx_v_nd);
11709 
11710  /* function exit code */
11711  __Pyx_RefNannyFinishContext();
11712  return __pyx_r;
11713 }
11714 
11715 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_60pyVectorRecoveryAtNodes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vectors, PyObject *__pyx_v_nodeElementsArray, PyObject *__pyx_v_nodeElementOffsets, PyObject *__pyx_v_nd) {
11716  PyObject *__pyx_r = NULL;
11717  __Pyx_RefNannyDeclarations
11718  __Pyx_memviewslice __pyx_t_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
11719  __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } };
11720  __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
11721  int __pyx_t_4;
11722  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
11723  PyObject *__pyx_t_6 = NULL;
11724  __Pyx_RefNannySetupContext("pyVectorRecoveryAtNodes", 0);
11725 
11726  /* "mprans/MeshSmoothing.pyx":723
11727  * nodeElementOffsets,
11728  * nd):
11729  * return cyVectorRecoveryAtNodes(vectors=vectors, # <<<<<<<<<<<<<<
11730  * nodeElementsArray=nodeElementsArray,
11731  * nodeElementOffsets=nodeElementOffsets,
11732  */
11733  __Pyx_XDECREF(__pyx_r);
11734  __pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_v_vectors, PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 723, __pyx_L1_error)
11735 
11736  /* "mprans/MeshSmoothing.pyx":724
11737  * nd):
11738  * return cyVectorRecoveryAtNodes(vectors=vectors,
11739  * nodeElementsArray=nodeElementsArray, # <<<<<<<<<<<<<<
11740  * nodeElementOffsets=nodeElementOffsets,
11741  * nd=nd)
11742  */
11743  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_nodeElementsArray, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 724, __pyx_L1_error)
11744 
11745  /* "mprans/MeshSmoothing.pyx":725
11746  * return cyVectorRecoveryAtNodes(vectors=vectors,
11747  * nodeElementsArray=nodeElementsArray,
11748  * nodeElementOffsets=nodeElementOffsets, # <<<<<<<<<<<<<<
11749  * nd=nd)
11750  *
11751  */
11752  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_nodeElementOffsets, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 725, __pyx_L1_error)
11753 
11754  /* "mprans/MeshSmoothing.pyx":726
11755  * nodeElementsArray=nodeElementsArray,
11756  * nodeElementOffsets=nodeElementOffsets,
11757  * nd=nd) # <<<<<<<<<<<<<<
11758  *
11759  * def pyVectorRecoveryAtNodesWeighted(double[:,:] vectors,
11760  */
11761  __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_nd); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 726, __pyx_L1_error)
11762 
11763  /* "mprans/MeshSmoothing.pyx":723
11764  * nodeElementOffsets,
11765  * nd):
11766  * return cyVectorRecoveryAtNodes(vectors=vectors, # <<<<<<<<<<<<<<
11767  * nodeElementsArray=nodeElementsArray,
11768  * nodeElementOffsets=nodeElementOffsets,
11769  */
11770  __pyx_t_5 = __pyx_f_6mprans_13MeshSmoothing_cyVectorRecoveryAtNodes(__pyx_t_1, __pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 723, __pyx_L1_error)
11771  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
11772  __pyx_t_1.memview = NULL;
11773  __pyx_t_1.data = NULL;
11774  __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
11775  __pyx_t_2.memview = NULL;
11776  __pyx_t_2.data = NULL;
11777  __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
11778  __pyx_t_3.memview = NULL;
11779  __pyx_t_3.data = NULL;
11780  __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_t_5, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 723, __pyx_L1_error)
11781  __Pyx_GOTREF(__pyx_t_6);
11782  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
11783  __pyx_t_5.memview = NULL;
11784  __pyx_t_5.data = NULL;
11785  __pyx_r = __pyx_t_6;
11786  __pyx_t_6 = 0;
11787  goto __pyx_L0;
11788 
11789  /* "mprans/MeshSmoothing.pyx":719
11790  * nNodes=nNodes)
11791  *
11792  * def pyVectorRecoveryAtNodes(vectors, # <<<<<<<<<<<<<<
11793  * nodeElementsArray,
11794  * nodeElementOffsets,
11795  */
11796 
11797  /* function exit code */
11798  __pyx_L1_error:;
11799  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
11800  __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
11801  __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
11802  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
11803  __Pyx_XDECREF(__pyx_t_6);
11804  __Pyx_AddTraceback("mprans.MeshSmoothing.pyVectorRecoveryAtNodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
11805  __pyx_r = NULL;
11806  __pyx_L0:;
11807  __Pyx_XGIVEREF(__pyx_r);
11808  __Pyx_RefNannyFinishContext();
11809  return __pyx_r;
11810 }
11811 
11812 /* "mprans/MeshSmoothing.pyx":728
11813  * nd=nd)
11814  *
11815  * def pyVectorRecoveryAtNodesWeighted(double[:,:] vectors, # <<<<<<<<<<<<<<
11816  * int[:] nodeElementsArray,
11817  * int[:] nodeElementOffsets,
11818  */
11819 
11820 /* Python wrapper */
11821 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_63pyVectorRecoveryAtNodesWeighted(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
11822 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_63pyVectorRecoveryAtNodesWeighted = {"pyVectorRecoveryAtNodesWeighted", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_63pyVectorRecoveryAtNodesWeighted, METH_VARARGS|METH_KEYWORDS, 0};
11823 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_63pyVectorRecoveryAtNodesWeighted(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
11824  __Pyx_memviewslice __pyx_v_vectors = { 0, 0, { 0 }, { 0 }, { 0 } };
11825  __Pyx_memviewslice __pyx_v_nodeElementsArray = { 0, 0, { 0 }, { 0 }, { 0 } };
11826  __Pyx_memviewslice __pyx_v_nodeElementOffsets = { 0, 0, { 0 }, { 0 }, { 0 } };
11827  __Pyx_memviewslice __pyx_v_detJ_array = { 0, 0, { 0 }, { 0 }, { 0 } };
11828  int __pyx_v_nd;
11829  PyObject *__pyx_r = 0;
11830  __Pyx_RefNannyDeclarations
11831  __Pyx_RefNannySetupContext("pyVectorRecoveryAtNodesWeighted (wrapper)", 0);
11832  {
11833  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vectors,&__pyx_n_s_nodeElementsArray,&__pyx_n_s_nodeElementOffsets,&__pyx_n_s_detJ_array,&__pyx_n_s_nd,0};
11834  PyObject* values[5] = {0,0,0,0,0};
11835  if (unlikely(__pyx_kwds)) {
11836  Py_ssize_t kw_args;
11837  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
11838  switch (pos_args) {
11839  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
11840  CYTHON_FALLTHROUGH;
11841  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11842  CYTHON_FALLTHROUGH;
11843  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11844  CYTHON_FALLTHROUGH;
11845  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11846  CYTHON_FALLTHROUGH;
11847  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11848  CYTHON_FALLTHROUGH;
11849  case 0: break;
11850  default: goto __pyx_L5_argtuple_error;
11851  }
11852  kw_args = PyDict_Size(__pyx_kwds);
11853  switch (pos_args) {
11854  case 0:
11855  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vectors)) != 0)) kw_args--;
11856  else goto __pyx_L5_argtuple_error;
11857  CYTHON_FALLTHROUGH;
11858  case 1:
11859  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementsArray)) != 0)) kw_args--;
11860  else {
11861  __Pyx_RaiseArgtupleInvalid("pyVectorRecoveryAtNodesWeighted", 1, 5, 5, 1); __PYX_ERR(0, 728, __pyx_L3_error)
11862  }
11863  CYTHON_FALLTHROUGH;
11864  case 2:
11865  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementOffsets)) != 0)) kw_args--;
11866  else {
11867  __Pyx_RaiseArgtupleInvalid("pyVectorRecoveryAtNodesWeighted", 1, 5, 5, 2); __PYX_ERR(0, 728, __pyx_L3_error)
11868  }
11869  CYTHON_FALLTHROUGH;
11870  case 3:
11871  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_detJ_array)) != 0)) kw_args--;
11872  else {
11873  __Pyx_RaiseArgtupleInvalid("pyVectorRecoveryAtNodesWeighted", 1, 5, 5, 3); __PYX_ERR(0, 728, __pyx_L3_error)
11874  }
11875  CYTHON_FALLTHROUGH;
11876  case 4:
11877  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
11878  else {
11879  __Pyx_RaiseArgtupleInvalid("pyVectorRecoveryAtNodesWeighted", 1, 5, 5, 4); __PYX_ERR(0, 728, __pyx_L3_error)
11880  }
11881  }
11882  if (unlikely(kw_args > 0)) {
11883  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pyVectorRecoveryAtNodesWeighted") < 0)) __PYX_ERR(0, 728, __pyx_L3_error)
11884  }
11885  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
11886  goto __pyx_L5_argtuple_error;
11887  } else {
11888  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11889  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11890  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11891  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11892  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
11893  }
11894  __pyx_v_vectors = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_vectors.memview)) __PYX_ERR(0, 728, __pyx_L3_error)
11895  __pyx_v_nodeElementsArray = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementsArray.memview)) __PYX_ERR(0, 729, __pyx_L3_error)
11896  __pyx_v_nodeElementOffsets = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementOffsets.memview)) __PYX_ERR(0, 730, __pyx_L3_error)
11897  __pyx_v_detJ_array = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_detJ_array.memview)) __PYX_ERR(0, 731, __pyx_L3_error)
11898  __pyx_v_nd = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 732, __pyx_L3_error)
11899  }
11900  goto __pyx_L4_argument_unpacking_done;
11901  __pyx_L5_argtuple_error:;
11902  __Pyx_RaiseArgtupleInvalid("pyVectorRecoveryAtNodesWeighted", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 728, __pyx_L3_error)
11903  __pyx_L3_error:;
11904  __Pyx_AddTraceback("mprans.MeshSmoothing.pyVectorRecoveryAtNodesWeighted", __pyx_clineno, __pyx_lineno, __pyx_filename);
11905  __Pyx_RefNannyFinishContext();
11906  return NULL;
11907  __pyx_L4_argument_unpacking_done:;
11908  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_62pyVectorRecoveryAtNodesWeighted(__pyx_self, __pyx_v_vectors, __pyx_v_nodeElementsArray, __pyx_v_nodeElementOffsets, __pyx_v_detJ_array, __pyx_v_nd);
11909 
11910  /* function exit code */
11911  __Pyx_RefNannyFinishContext();
11912  return __pyx_r;
11913 }
11914 
11915 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_62pyVectorRecoveryAtNodesWeighted(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_vectors, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_detJ_array, int __pyx_v_nd) {
11916  PyObject *__pyx_r = NULL;
11917  __Pyx_RefNannyDeclarations
11918  __Pyx_memviewslice __pyx_t_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
11919  PyObject *__pyx_t_2 = NULL;
11920  __Pyx_RefNannySetupContext("pyVectorRecoveryAtNodesWeighted", 0);
11921 
11922  /* "mprans/MeshSmoothing.pyx":733
11923  * double[:,:] detJ_array,
11924  * int nd):
11925  * return cyVectorRecoveryAtNodesWeighted(vectors=vectors, # <<<<<<<<<<<<<<
11926  * nodeElementsArray=nodeElementsArray,
11927  * nodeElementOffsets=nodeElementOffsets,
11928  */
11929  __Pyx_XDECREF(__pyx_r);
11930 
11931  /* "mprans/MeshSmoothing.pyx":737
11932  * nodeElementOffsets=nodeElementOffsets,
11933  * detJ_array=detJ_array,
11934  * nd=nd) # <<<<<<<<<<<<<<
11935  *
11936  * ### Cython implementation of functions above
11937  */
11938  __pyx_t_1 = __pyx_f_6mprans_13MeshSmoothing_cyVectorRecoveryAtNodesWeighted(__pyx_v_vectors, __pyx_v_nodeElementsArray, __pyx_v_nodeElementOffsets, __pyx_v_detJ_array, __pyx_v_nd); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 733, __pyx_L1_error)
11939 
11940  /* "mprans/MeshSmoothing.pyx":733
11941  * double[:,:] detJ_array,
11942  * int nd):
11943  * return cyVectorRecoveryAtNodesWeighted(vectors=vectors, # <<<<<<<<<<<<<<
11944  * nodeElementsArray=nodeElementsArray,
11945  * nodeElementOffsets=nodeElementOffsets,
11946  */
11947  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_t_1, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 733, __pyx_L1_error)
11948  __Pyx_GOTREF(__pyx_t_2);
11949  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
11950  __pyx_t_1.memview = NULL;
11951  __pyx_t_1.data = NULL;
11952  __pyx_r = __pyx_t_2;
11953  __pyx_t_2 = 0;
11954  goto __pyx_L0;
11955 
11956  /* "mprans/MeshSmoothing.pyx":728
11957  * nd=nd)
11958  *
11959  * def pyVectorRecoveryAtNodesWeighted(double[:,:] vectors, # <<<<<<<<<<<<<<
11960  * int[:] nodeElementsArray,
11961  * int[:] nodeElementOffsets,
11962  */
11963 
11964  /* function exit code */
11965  __pyx_L1_error:;
11966  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
11967  __Pyx_XDECREF(__pyx_t_2);
11968  __Pyx_AddTraceback("mprans.MeshSmoothing.pyVectorRecoveryAtNodesWeighted", __pyx_clineno, __pyx_lineno, __pyx_filename);
11969  __pyx_r = NULL;
11970  __pyx_L0:;
11971  __PYX_XDEC_MEMVIEW(&__pyx_v_vectors, 1);
11972  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementsArray, 1);
11973  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementOffsets, 1);
11974  __PYX_XDEC_MEMVIEW(&__pyx_v_detJ_array, 1);
11975  __Pyx_XGIVEREF(__pyx_r);
11976  __Pyx_RefNannyFinishContext();
11977  return __pyx_r;
11978 }
11979 
11980 /* "mprans/MeshSmoothing.pyx":741
11981  * ### Cython implementation of functions above
11982  *
11983  * cdef void cySmoothNodesLaplace(double[:,:] nodeArray_, # <<<<<<<<<<<<<<
11984  * int[:] nodeStarOffsets,
11985  * int[:] nodeStarArray,
11986  */
11987 
11988 static void __pyx_f_6mprans_13MeshSmoothing_cySmoothNodesLaplace(__Pyx_memviewslice __pyx_v_nodeArray_, __Pyx_memviewslice __pyx_v_nodeStarOffsets, __Pyx_memviewslice __pyx_v_nodeStarArray, __Pyx_memviewslice __pyx_v_nodeMaterialTypes, int __pyx_v_nNodes_owned, int __pyx_v_nd, struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesLaplace *__pyx_optional_args) {
11989 
11990  /* "mprans/MeshSmoothing.pyx":747
11991  * int nNodes_owned,
11992  * int nd,
11993  * bool simultaneous=False, # <<<<<<<<<<<<<<
11994  * bool smoothBoundaries=True,
11995  * int[:] fixedNodesBoolArray=None,
11996  */
11997  bool __pyx_v_simultaneous = ((bool)0);
11998 
11999  /* "mprans/MeshSmoothing.pyx":748
12000  * int nd,
12001  * bool simultaneous=False,
12002  * bool smoothBoundaries=True, # <<<<<<<<<<<<<<
12003  * int[:] fixedNodesBoolArray=None,
12004  * double alpha=0.):
12005  */
12006  bool __pyx_v_smoothBoundaries = ((bool)1);
12007  __Pyx_memviewslice __pyx_v_fixedNodesBoolArray = __pyx_k__5;
12008  double __pyx_v_alpha = ((double)0.);
12009  __Pyx_memviewslice __pyx_v_nodeArray0 = { 0, 0, { 0 }, { 0 }, { 0 } };
12010  double __pyx_v_sum_star[3];
12011  int __pyx_v_nNodes;
12012  bool __pyx_v_fixed_node;
12013  __Pyx_memviewslice __pyx_v_fixed_dir = { 0, 0, { 0 }, { 0 }, { 0 } };
12014  int __pyx_v_nOffset;
12015  int __pyx_v_node;
12016  __Pyx_RefNannyDeclarations
12017  int __pyx_t_1;
12018  int __pyx_t_2;
12019  __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
12020  PyObject *__pyx_t_4 = NULL;
12021  PyObject *__pyx_t_5 = NULL;
12022  PyObject *__pyx_t_6 = NULL;
12023  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
12024  int __pyx_t_8;
12025  int __pyx_t_9;
12026  int __pyx_t_10;
12027  Py_ssize_t __pyx_t_11;
12028  Py_ssize_t __pyx_t_12;
12029  int __pyx_t_13;
12030  Py_ssize_t __pyx_t_14;
12031  int __pyx_t_15;
12032  int __pyx_t_16;
12033  long __pyx_t_17;
12034  Py_ssize_t __pyx_t_18;
12035  Py_ssize_t __pyx_t_19;
12036  Py_ssize_t __pyx_t_20;
12037  Py_ssize_t __pyx_t_21;
12038  Py_ssize_t __pyx_t_22;
12039  Py_ssize_t __pyx_t_23;
12040  Py_ssize_t __pyx_t_24;
12041  Py_ssize_t __pyx_t_25;
12042  Py_ssize_t __pyx_t_26;
12043  Py_ssize_t __pyx_t_27;
12044  Py_ssize_t __pyx_t_28;
12045  Py_ssize_t __pyx_t_29;
12046  Py_ssize_t __pyx_t_30;
12047  Py_ssize_t __pyx_t_31;
12048  Py_ssize_t __pyx_t_32;
12049  Py_ssize_t __pyx_t_33;
12050  Py_ssize_t __pyx_t_34;
12051  Py_ssize_t __pyx_t_35;
12052  Py_ssize_t __pyx_t_36;
12053  Py_ssize_t __pyx_t_37;
12054  Py_ssize_t __pyx_t_38;
12055  Py_ssize_t __pyx_t_39;
12056  Py_ssize_t __pyx_t_40;
12057  Py_ssize_t __pyx_t_41;
12058  Py_ssize_t __pyx_t_42;
12059  Py_ssize_t __pyx_t_43;
12060  Py_ssize_t __pyx_t_44;
12061  Py_ssize_t __pyx_t_45;
12062  Py_ssize_t __pyx_t_46;
12063  Py_ssize_t __pyx_t_47;
12064  Py_ssize_t __pyx_t_48;
12065  Py_ssize_t __pyx_t_49;
12066  Py_ssize_t __pyx_t_50;
12067  Py_ssize_t __pyx_t_51;
12068  Py_ssize_t __pyx_t_52;
12069  Py_ssize_t __pyx_t_53;
12070  Py_ssize_t __pyx_t_54;
12071  Py_ssize_t __pyx_t_55;
12072  Py_ssize_t __pyx_t_56;
12073  Py_ssize_t __pyx_t_57;
12074  Py_ssize_t __pyx_t_58;
12075  Py_ssize_t __pyx_t_59;
12076  Py_ssize_t __pyx_t_60;
12077  Py_ssize_t __pyx_t_61;
12078  Py_ssize_t __pyx_t_62;
12079  Py_ssize_t __pyx_t_63;
12080  Py_ssize_t __pyx_t_64;
12081  Py_ssize_t __pyx_t_65;
12082  Py_ssize_t __pyx_t_66;
12083  Py_ssize_t __pyx_t_67;
12084  Py_ssize_t __pyx_t_68;
12085  Py_ssize_t __pyx_t_69;
12086  Py_ssize_t __pyx_t_70;
12087  Py_ssize_t __pyx_t_71;
12088  Py_ssize_t __pyx_t_72;
12089  Py_ssize_t __pyx_t_73;
12090  Py_ssize_t __pyx_t_74;
12091  Py_ssize_t __pyx_t_75;
12092  Py_ssize_t __pyx_t_76;
12093  Py_ssize_t __pyx_t_77;
12094  Py_ssize_t __pyx_t_78;
12095  Py_ssize_t __pyx_t_79;
12096  Py_ssize_t __pyx_t_80;
12097  Py_ssize_t __pyx_t_81;
12098  Py_ssize_t __pyx_t_82;
12099  Py_ssize_t __pyx_t_83;
12100  Py_ssize_t __pyx_t_84;
12101  Py_ssize_t __pyx_t_85;
12102  Py_ssize_t __pyx_t_86;
12103  Py_ssize_t __pyx_t_87;
12104  Py_ssize_t __pyx_t_88;
12105  Py_ssize_t __pyx_t_89;
12106  __Pyx_RefNannySetupContext("cySmoothNodesLaplace", 0);
12107  if (__pyx_optional_args) {
12108  if (__pyx_optional_args->__pyx_n > 0) {
12109  __pyx_v_simultaneous = __pyx_optional_args->simultaneous;
12110  if (__pyx_optional_args->__pyx_n > 1) {
12111  __pyx_v_smoothBoundaries = __pyx_optional_args->smoothBoundaries;
12112  if (__pyx_optional_args->__pyx_n > 2) {
12113  __pyx_v_fixedNodesBoolArray = __pyx_optional_args->fixedNodesBoolArray;
12114  if (__pyx_optional_args->__pyx_n > 3) {
12115  __pyx_v_alpha = __pyx_optional_args->alpha;
12116  }
12117  }
12118  }
12119  }
12120  }
12121 
12122  /* "mprans/MeshSmoothing.pyx":752
12123  * double alpha=0.):
12124  * cdef double[:,:] nodeArray0
12125  * if simultaneous or alpha!= 0: # <<<<<<<<<<<<<<
12126  * nodeArray0 = nodeArray_.copy()
12127  * cdef double[3] sum_star
12128  */
12129  __pyx_t_2 = (__pyx_v_simultaneous != 0);
12130  if (!__pyx_t_2) {
12131  } else {
12132  __pyx_t_1 = __pyx_t_2;
12133  goto __pyx_L4_bool_binop_done;
12134  }
12135  __pyx_t_2 = ((__pyx_v_alpha != 0.0) != 0);
12136  __pyx_t_1 = __pyx_t_2;
12137  __pyx_L4_bool_binop_done:;
12138  if (__pyx_t_1) {
12139 
12140  /* "mprans/MeshSmoothing.pyx":753
12141  * cdef double[:,:] nodeArray0
12142  * if simultaneous or alpha!= 0:
12143  * nodeArray0 = nodeArray_.copy() # <<<<<<<<<<<<<<
12144  * cdef double[3] sum_star
12145  * cdef double dot
12146  */
12147  __pyx_t_3 = __pyx_memoryview_copy_slice_d_dc_double_c(__pyx_v_nodeArray_); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 753, __pyx_L1_error)
12148  __pyx_v_nodeArray0 = __pyx_t_3;
12149  __pyx_t_3.memview = NULL;
12150  __pyx_t_3.data = NULL;
12151 
12152  /* "mprans/MeshSmoothing.pyx":752
12153  * double alpha=0.):
12154  * cdef double[:,:] nodeArray0
12155  * if simultaneous or alpha!= 0: # <<<<<<<<<<<<<<
12156  * nodeArray0 = nodeArray_.copy()
12157  * cdef double[3] sum_star
12158  */
12159  }
12160 
12161  /* "mprans/MeshSmoothing.pyx":757
12162  * cdef double dot
12163  * cdef int nNodeInStar
12164  * cdef int nNodes = 0 # <<<<<<<<<<<<<<
12165  * cdef bool fixed_node = False
12166  * cdef double[:] fixed_dir = np.zeros(3)
12167  */
12168  __pyx_v_nNodes = 0;
12169 
12170  /* "mprans/MeshSmoothing.pyx":758
12171  * cdef int nNodeInStar
12172  * cdef int nNodes = 0
12173  * cdef bool fixed_node = False # <<<<<<<<<<<<<<
12174  * cdef double[:] fixed_dir = np.zeros(3)
12175  * cdef double fixed_dir_dist
12176  */
12177  __pyx_v_fixed_node = 0;
12178 
12179  /* "mprans/MeshSmoothing.pyx":759
12180  * cdef int nNodes = 0
12181  * cdef bool fixed_node = False
12182  * cdef double[:] fixed_dir = np.zeros(3) # <<<<<<<<<<<<<<
12183  * cdef double fixed_dir_dist
12184  * cdef int nOffset
12185  */
12186  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 759, __pyx_L1_error)
12187  __Pyx_GOTREF(__pyx_t_5);
12188  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 759, __pyx_L1_error)
12189  __Pyx_GOTREF(__pyx_t_6);
12190  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12191  __pyx_t_5 = NULL;
12192  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
12193  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
12194  if (likely(__pyx_t_5)) {
12195  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
12196  __Pyx_INCREF(__pyx_t_5);
12197  __Pyx_INCREF(function);
12198  __Pyx_DECREF_SET(__pyx_t_6, function);
12199  }
12200  }
12201  __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, __pyx_int_3) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_int_3);
12202  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12203  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 759, __pyx_L1_error)
12204  __Pyx_GOTREF(__pyx_t_4);
12205  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12206  __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 759, __pyx_L1_error)
12207  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12208  __pyx_v_fixed_dir = __pyx_t_7;
12209  __pyx_t_7.memview = NULL;
12210  __pyx_t_7.data = NULL;
12211 
12212  /* "mprans/MeshSmoothing.pyx":763
12213  * cdef int nOffset
12214  * cdef int node
12215  * for node in range(nNodes_owned): # <<<<<<<<<<<<<<
12216  * sum_star[0] = 0.
12217  * sum_star[1] = 0.
12218  */
12219  __pyx_t_8 = __pyx_v_nNodes_owned;
12220  __pyx_t_9 = __pyx_t_8;
12221  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
12222  __pyx_v_node = __pyx_t_10;
12223 
12224  /* "mprans/MeshSmoothing.pyx":764
12225  * cdef int node
12226  * for node in range(nNodes_owned):
12227  * sum_star[0] = 0. # <<<<<<<<<<<<<<
12228  * sum_star[1] = 0.
12229  * sum_star[2] = 0.
12230  */
12231  (__pyx_v_sum_star[0]) = 0.;
12232 
12233  /* "mprans/MeshSmoothing.pyx":765
12234  * for node in range(nNodes_owned):
12235  * sum_star[0] = 0.
12236  * sum_star[1] = 0. # <<<<<<<<<<<<<<
12237  * sum_star[2] = 0.
12238  * nNodes = 0
12239  */
12240  (__pyx_v_sum_star[1]) = 0.;
12241 
12242  /* "mprans/MeshSmoothing.pyx":766
12243  * sum_star[0] = 0.
12244  * sum_star[1] = 0.
12245  * sum_star[2] = 0. # <<<<<<<<<<<<<<
12246  * nNodes = 0
12247  * if nodeMaterialTypes[node] == 0:
12248  */
12249  (__pyx_v_sum_star[2]) = 0.;
12250 
12251  /* "mprans/MeshSmoothing.pyx":767
12252  * sum_star[1] = 0.
12253  * sum_star[2] = 0.
12254  * nNodes = 0 # <<<<<<<<<<<<<<
12255  * if nodeMaterialTypes[node] == 0:
12256  * for nOffset in range(nodeStarOffsets[node],
12257  */
12258  __pyx_v_nNodes = 0;
12259 
12260  /* "mprans/MeshSmoothing.pyx":768
12261  * sum_star[2] = 0.
12262  * nNodes = 0
12263  * if nodeMaterialTypes[node] == 0: # <<<<<<<<<<<<<<
12264  * for nOffset in range(nodeStarOffsets[node],
12265  * nodeStarOffsets[node+1]):
12266  */
12267  __pyx_t_11 = __pyx_v_node;
12268  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_nodeMaterialTypes.shape[0];
12269  __pyx_t_1 = (((*((int *) ( /* dim=0 */ (__pyx_v_nodeMaterialTypes.data + __pyx_t_11 * __pyx_v_nodeMaterialTypes.strides[0]) ))) == 0) != 0);
12270  if (__pyx_t_1) {
12271 
12272  /* "mprans/MeshSmoothing.pyx":770
12273  * if nodeMaterialTypes[node] == 0:
12274  * for nOffset in range(nodeStarOffsets[node],
12275  * nodeStarOffsets[node+1]): # <<<<<<<<<<<<<<
12276  * if simultaneous is True:
12277  * sum_star[0] += nodeArray0[nodeStarArray[nOffset], 0]
12278  */
12279  __pyx_t_12 = (__pyx_v_node + 1);
12280  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_nodeStarOffsets.shape[0];
12281  __pyx_t_13 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarOffsets.data + __pyx_t_12 * __pyx_v_nodeStarOffsets.strides[0]) )));
12282 
12283  /* "mprans/MeshSmoothing.pyx":769
12284  * nNodes = 0
12285  * if nodeMaterialTypes[node] == 0:
12286  * for nOffset in range(nodeStarOffsets[node], # <<<<<<<<<<<<<<
12287  * nodeStarOffsets[node+1]):
12288  * if simultaneous is True:
12289  */
12290  __pyx_t_14 = __pyx_v_node;
12291  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_nodeStarOffsets.shape[0];
12292 
12293  /* "mprans/MeshSmoothing.pyx":770
12294  * if nodeMaterialTypes[node] == 0:
12295  * for nOffset in range(nodeStarOffsets[node],
12296  * nodeStarOffsets[node+1]): # <<<<<<<<<<<<<<
12297  * if simultaneous is True:
12298  * sum_star[0] += nodeArray0[nodeStarArray[nOffset], 0]
12299  */
12300  __pyx_t_15 = __pyx_t_13;
12301  for (__pyx_t_16 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarOffsets.data + __pyx_t_14 * __pyx_v_nodeStarOffsets.strides[0]) ))); __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
12302 
12303  /* "mprans/MeshSmoothing.pyx":769
12304  * nNodes = 0
12305  * if nodeMaterialTypes[node] == 0:
12306  * for nOffset in range(nodeStarOffsets[node], # <<<<<<<<<<<<<<
12307  * nodeStarOffsets[node+1]):
12308  * if simultaneous is True:
12309  */
12310  __pyx_v_nOffset = __pyx_t_16;
12311 
12312  /* "mprans/MeshSmoothing.pyx":771
12313  * for nOffset in range(nodeStarOffsets[node],
12314  * nodeStarOffsets[node+1]):
12315  * if simultaneous is True: # <<<<<<<<<<<<<<
12316  * sum_star[0] += nodeArray0[nodeStarArray[nOffset], 0]
12317  * sum_star[1] += nodeArray0[nodeStarArray[nOffset], 1]
12318  */
12319  __pyx_t_1 = ((__pyx_v_simultaneous == 1) != 0);
12320  if (__pyx_t_1) {
12321 
12322  /* "mprans/MeshSmoothing.pyx":772
12323  * nodeStarOffsets[node+1]):
12324  * if simultaneous is True:
12325  * sum_star[0] += nodeArray0[nodeStarArray[nOffset], 0] # <<<<<<<<<<<<<<
12326  * sum_star[1] += nodeArray0[nodeStarArray[nOffset], 1]
12327  * sum_star[2] += nodeArray0[nodeStarArray[nOffset], 2]
12328  */
12329  __pyx_t_17 = 0;
12330  __pyx_t_18 = __pyx_v_nOffset;
12331  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_nodeStarArray.shape[0];
12332  __pyx_t_19 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_18 * __pyx_v_nodeStarArray.strides[0]) )));
12333  __pyx_t_20 = 0;
12334  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_nodeArray0.shape[0];
12335  if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_nodeArray0.shape[1];
12336  (__pyx_v_sum_star[__pyx_t_17]) = ((__pyx_v_sum_star[__pyx_t_17]) + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray0.data + __pyx_t_19 * __pyx_v_nodeArray0.strides[0]) ) + __pyx_t_20 * __pyx_v_nodeArray0.strides[1]) ))));
12337 
12338  /* "mprans/MeshSmoothing.pyx":773
12339  * if simultaneous is True:
12340  * sum_star[0] += nodeArray0[nodeStarArray[nOffset], 0]
12341  * sum_star[1] += nodeArray0[nodeStarArray[nOffset], 1] # <<<<<<<<<<<<<<
12342  * sum_star[2] += nodeArray0[nodeStarArray[nOffset], 2]
12343  * else:
12344  */
12345  __pyx_t_17 = 1;
12346  __pyx_t_21 = __pyx_v_nOffset;
12347  if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_nodeStarArray.shape[0];
12348  __pyx_t_22 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_21 * __pyx_v_nodeStarArray.strides[0]) )));
12349  __pyx_t_23 = 1;
12350  if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_nodeArray0.shape[0];
12351  if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_nodeArray0.shape[1];
12352  (__pyx_v_sum_star[__pyx_t_17]) = ((__pyx_v_sum_star[__pyx_t_17]) + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray0.data + __pyx_t_22 * __pyx_v_nodeArray0.strides[0]) ) + __pyx_t_23 * __pyx_v_nodeArray0.strides[1]) ))));
12353 
12354  /* "mprans/MeshSmoothing.pyx":774
12355  * sum_star[0] += nodeArray0[nodeStarArray[nOffset], 0]
12356  * sum_star[1] += nodeArray0[nodeStarArray[nOffset], 1]
12357  * sum_star[2] += nodeArray0[nodeStarArray[nOffset], 2] # <<<<<<<<<<<<<<
12358  * else:
12359  * sum_star[0] += nodeArray_[nodeStarArray[nOffset], 0]
12360  */
12361  __pyx_t_17 = 2;
12362  __pyx_t_24 = __pyx_v_nOffset;
12363  if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_nodeStarArray.shape[0];
12364  __pyx_t_25 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_24 * __pyx_v_nodeStarArray.strides[0]) )));
12365  __pyx_t_26 = 2;
12366  if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_nodeArray0.shape[0];
12367  if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_nodeArray0.shape[1];
12368  (__pyx_v_sum_star[__pyx_t_17]) = ((__pyx_v_sum_star[__pyx_t_17]) + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray0.data + __pyx_t_25 * __pyx_v_nodeArray0.strides[0]) ) + __pyx_t_26 * __pyx_v_nodeArray0.strides[1]) ))));
12369 
12370  /* "mprans/MeshSmoothing.pyx":771
12371  * for nOffset in range(nodeStarOffsets[node],
12372  * nodeStarOffsets[node+1]):
12373  * if simultaneous is True: # <<<<<<<<<<<<<<
12374  * sum_star[0] += nodeArray0[nodeStarArray[nOffset], 0]
12375  * sum_star[1] += nodeArray0[nodeStarArray[nOffset], 1]
12376  */
12377  goto __pyx_L11;
12378  }
12379 
12380  /* "mprans/MeshSmoothing.pyx":776
12381  * sum_star[2] += nodeArray0[nodeStarArray[nOffset], 2]
12382  * else:
12383  * sum_star[0] += nodeArray_[nodeStarArray[nOffset], 0] # <<<<<<<<<<<<<<
12384  * sum_star[1] += nodeArray_[nodeStarArray[nOffset], 1]
12385  * sum_star[2] += nodeArray_[nodeStarArray[nOffset], 2]
12386  */
12387  /*else*/ {
12388  __pyx_t_17 = 0;
12389  __pyx_t_27 = __pyx_v_nOffset;
12390  if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_nodeStarArray.shape[0];
12391  __pyx_t_28 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_27 * __pyx_v_nodeStarArray.strides[0]) )));
12392  __pyx_t_29 = 0;
12393  if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_nodeArray_.shape[0];
12394  if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_nodeArray_.shape[1];
12395  (__pyx_v_sum_star[__pyx_t_17]) = ((__pyx_v_sum_star[__pyx_t_17]) + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_28 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_29 * __pyx_v_nodeArray_.strides[1]) ))));
12396 
12397  /* "mprans/MeshSmoothing.pyx":777
12398  * else:
12399  * sum_star[0] += nodeArray_[nodeStarArray[nOffset], 0]
12400  * sum_star[1] += nodeArray_[nodeStarArray[nOffset], 1] # <<<<<<<<<<<<<<
12401  * sum_star[2] += nodeArray_[nodeStarArray[nOffset], 2]
12402  * nNodes += 1
12403  */
12404  __pyx_t_17 = 1;
12405  __pyx_t_30 = __pyx_v_nOffset;
12406  if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_nodeStarArray.shape[0];
12407  __pyx_t_31 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_30 * __pyx_v_nodeStarArray.strides[0]) )));
12408  __pyx_t_32 = 1;
12409  if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_nodeArray_.shape[0];
12410  if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_nodeArray_.shape[1];
12411  (__pyx_v_sum_star[__pyx_t_17]) = ((__pyx_v_sum_star[__pyx_t_17]) + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_31 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_32 * __pyx_v_nodeArray_.strides[1]) ))));
12412 
12413  /* "mprans/MeshSmoothing.pyx":778
12414  * sum_star[0] += nodeArray_[nodeStarArray[nOffset], 0]
12415  * sum_star[1] += nodeArray_[nodeStarArray[nOffset], 1]
12416  * sum_star[2] += nodeArray_[nodeStarArray[nOffset], 2] # <<<<<<<<<<<<<<
12417  * nNodes += 1
12418  * nodeArray_[node, 0] = sum_star[0]/nNodes
12419  */
12420  __pyx_t_17 = 2;
12421  __pyx_t_33 = __pyx_v_nOffset;
12422  if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_nodeStarArray.shape[0];
12423  __pyx_t_34 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_33 * __pyx_v_nodeStarArray.strides[0]) )));
12424  __pyx_t_35 = 2;
12425  if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_nodeArray_.shape[0];
12426  if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_nodeArray_.shape[1];
12427  (__pyx_v_sum_star[__pyx_t_17]) = ((__pyx_v_sum_star[__pyx_t_17]) + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_34 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_35 * __pyx_v_nodeArray_.strides[1]) ))));
12428  }
12429  __pyx_L11:;
12430 
12431  /* "mprans/MeshSmoothing.pyx":779
12432  * sum_star[1] += nodeArray_[nodeStarArray[nOffset], 1]
12433  * sum_star[2] += nodeArray_[nodeStarArray[nOffset], 2]
12434  * nNodes += 1 # <<<<<<<<<<<<<<
12435  * nodeArray_[node, 0] = sum_star[0]/nNodes
12436  * nodeArray_[node, 1] = sum_star[1]/nNodes
12437  */
12438  __pyx_v_nNodes = (__pyx_v_nNodes + 1);
12439  }
12440 
12441  /* "mprans/MeshSmoothing.pyx":780
12442  * sum_star[2] += nodeArray_[nodeStarArray[nOffset], 2]
12443  * nNodes += 1
12444  * nodeArray_[node, 0] = sum_star[0]/nNodes # <<<<<<<<<<<<<<
12445  * nodeArray_[node, 1] = sum_star[1]/nNodes
12446  * nodeArray_[node, 2] = sum_star[2]/nNodes
12447  */
12448  __pyx_t_36 = __pyx_v_node;
12449  __pyx_t_37 = 0;
12450  if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_nodeArray_.shape[0];
12451  if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_nodeArray_.shape[1];
12452  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_36 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_37 * __pyx_v_nodeArray_.strides[1]) )) = ((__pyx_v_sum_star[0]) / __pyx_v_nNodes);
12453 
12454  /* "mprans/MeshSmoothing.pyx":781
12455  * nNodes += 1
12456  * nodeArray_[node, 0] = sum_star[0]/nNodes
12457  * nodeArray_[node, 1] = sum_star[1]/nNodes # <<<<<<<<<<<<<<
12458  * nodeArray_[node, 2] = sum_star[2]/nNodes
12459  * # boundary smoothing not ready yet
12460  */
12461  __pyx_t_38 = __pyx_v_node;
12462  __pyx_t_39 = 1;
12463  if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_nodeArray_.shape[0];
12464  if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_v_nodeArray_.shape[1];
12465  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_38 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_39 * __pyx_v_nodeArray_.strides[1]) )) = ((__pyx_v_sum_star[1]) / __pyx_v_nNodes);
12466 
12467  /* "mprans/MeshSmoothing.pyx":782
12468  * nodeArray_[node, 0] = sum_star[0]/nNodes
12469  * nodeArray_[node, 1] = sum_star[1]/nNodes
12470  * nodeArray_[node, 2] = sum_star[2]/nNodes # <<<<<<<<<<<<<<
12471  * # boundary smoothing not ready yet
12472  * elif smoothBoundaries is True:
12473  */
12474  __pyx_t_40 = __pyx_v_node;
12475  __pyx_t_41 = 2;
12476  if (__pyx_t_40 < 0) __pyx_t_40 += __pyx_v_nodeArray_.shape[0];
12477  if (__pyx_t_41 < 0) __pyx_t_41 += __pyx_v_nodeArray_.shape[1];
12478  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_40 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_41 * __pyx_v_nodeArray_.strides[1]) )) = ((__pyx_v_sum_star[2]) / __pyx_v_nNodes);
12479 
12480  /* "mprans/MeshSmoothing.pyx":768
12481  * sum_star[2] = 0.
12482  * nNodes = 0
12483  * if nodeMaterialTypes[node] == 0: # <<<<<<<<<<<<<<
12484  * for nOffset in range(nodeStarOffsets[node],
12485  * nodeStarOffsets[node+1]):
12486  */
12487  goto __pyx_L8;
12488  }
12489 
12490  /* "mprans/MeshSmoothing.pyx":784
12491  * nodeArray_[node, 2] = sum_star[2]/nNodes
12492  * # boundary smoothing not ready yet
12493  * elif smoothBoundaries is True: # <<<<<<<<<<<<<<
12494  * # smooth on boundary only
12495  * fixed_node = False
12496  */
12497  __pyx_t_1 = ((__pyx_v_smoothBoundaries == 1) != 0);
12498  if (__pyx_t_1) {
12499 
12500  /* "mprans/MeshSmoothing.pyx":786
12501  * elif smoothBoundaries is True:
12502  * # smooth on boundary only
12503  * fixed_node = False # <<<<<<<<<<<<<<
12504  * if fixedNodesBoolArray is not None:
12505  * if fixedNodesBoolArray[node] == 1:
12506  */
12507  __pyx_v_fixed_node = 0;
12508 
12509  /* "mprans/MeshSmoothing.pyx":787
12510  * # smooth on boundary only
12511  * fixed_node = False
12512  * if fixedNodesBoolArray is not None: # <<<<<<<<<<<<<<
12513  * if fixedNodesBoolArray[node] == 1:
12514  * sum_star[0] = nodeArray0[node, 0]
12515  */
12516  __pyx_t_1 = ((((PyObject *) __pyx_v_fixedNodesBoolArray.memview) != Py_None) != 0);
12517  if (__pyx_t_1) {
12518 
12519  /* "mprans/MeshSmoothing.pyx":788
12520  * fixed_node = False
12521  * if fixedNodesBoolArray is not None:
12522  * if fixedNodesBoolArray[node] == 1: # <<<<<<<<<<<<<<
12523  * sum_star[0] = nodeArray0[node, 0]
12524  * sum_star[1] = nodeArray0[node, 1]
12525  */
12526  __pyx_t_42 = __pyx_v_node;
12527  if (__pyx_t_42 < 0) __pyx_t_42 += __pyx_v_fixedNodesBoolArray.shape[0];
12528  __pyx_t_1 = (((*((int *) ( /* dim=0 */ (__pyx_v_fixedNodesBoolArray.data + __pyx_t_42 * __pyx_v_fixedNodesBoolArray.strides[0]) ))) == 1) != 0);
12529  if (__pyx_t_1) {
12530 
12531  /* "mprans/MeshSmoothing.pyx":789
12532  * if fixedNodesBoolArray is not None:
12533  * if fixedNodesBoolArray[node] == 1:
12534  * sum_star[0] = nodeArray0[node, 0] # <<<<<<<<<<<<<<
12535  * sum_star[1] = nodeArray0[node, 1]
12536  * sum_star[2] = nodeArray0[node, 2]
12537  */
12538  __pyx_t_43 = __pyx_v_node;
12539  __pyx_t_44 = 0;
12540  if (__pyx_t_43 < 0) __pyx_t_43 += __pyx_v_nodeArray0.shape[0];
12541  if (__pyx_t_44 < 0) __pyx_t_44 += __pyx_v_nodeArray0.shape[1];
12542  (__pyx_v_sum_star[0]) = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray0.data + __pyx_t_43 * __pyx_v_nodeArray0.strides[0]) ) + __pyx_t_44 * __pyx_v_nodeArray0.strides[1]) )));
12543 
12544  /* "mprans/MeshSmoothing.pyx":790
12545  * if fixedNodesBoolArray[node] == 1:
12546  * sum_star[0] = nodeArray0[node, 0]
12547  * sum_star[1] = nodeArray0[node, 1] # <<<<<<<<<<<<<<
12548  * sum_star[2] = nodeArray0[node, 2]
12549  * nNodes = 1
12550  */
12551  __pyx_t_45 = __pyx_v_node;
12552  __pyx_t_46 = 1;
12553  if (__pyx_t_45 < 0) __pyx_t_45 += __pyx_v_nodeArray0.shape[0];
12554  if (__pyx_t_46 < 0) __pyx_t_46 += __pyx_v_nodeArray0.shape[1];
12555  (__pyx_v_sum_star[1]) = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray0.data + __pyx_t_45 * __pyx_v_nodeArray0.strides[0]) ) + __pyx_t_46 * __pyx_v_nodeArray0.strides[1]) )));
12556 
12557  /* "mprans/MeshSmoothing.pyx":791
12558  * sum_star[0] = nodeArray0[node, 0]
12559  * sum_star[1] = nodeArray0[node, 1]
12560  * sum_star[2] = nodeArray0[node, 2] # <<<<<<<<<<<<<<
12561  * nNodes = 1
12562  * fixed_node = True
12563  */
12564  __pyx_t_47 = __pyx_v_node;
12565  __pyx_t_48 = 2;
12566  if (__pyx_t_47 < 0) __pyx_t_47 += __pyx_v_nodeArray0.shape[0];
12567  if (__pyx_t_48 < 0) __pyx_t_48 += __pyx_v_nodeArray0.shape[1];
12568  (__pyx_v_sum_star[2]) = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray0.data + __pyx_t_47 * __pyx_v_nodeArray0.strides[0]) ) + __pyx_t_48 * __pyx_v_nodeArray0.strides[1]) )));
12569 
12570  /* "mprans/MeshSmoothing.pyx":792
12571  * sum_star[1] = nodeArray0[node, 1]
12572  * sum_star[2] = nodeArray0[node, 2]
12573  * nNodes = 1 # <<<<<<<<<<<<<<
12574  * fixed_node = True
12575  * if fixed_node is False:
12576  */
12577  __pyx_v_nNodes = 1;
12578 
12579  /* "mprans/MeshSmoothing.pyx":793
12580  * sum_star[2] = nodeArray0[node, 2]
12581  * nNodes = 1
12582  * fixed_node = True # <<<<<<<<<<<<<<
12583  * if fixed_node is False:
12584  * if nd == 2:
12585  */
12586  __pyx_v_fixed_node = 1;
12587 
12588  /* "mprans/MeshSmoothing.pyx":788
12589  * fixed_node = False
12590  * if fixedNodesBoolArray is not None:
12591  * if fixedNodesBoolArray[node] == 1: # <<<<<<<<<<<<<<
12592  * sum_star[0] = nodeArray0[node, 0]
12593  * sum_star[1] = nodeArray0[node, 1]
12594  */
12595  }
12596 
12597  /* "mprans/MeshSmoothing.pyx":787
12598  * # smooth on boundary only
12599  * fixed_node = False
12600  * if fixedNodesBoolArray is not None: # <<<<<<<<<<<<<<
12601  * if fixedNodesBoolArray[node] == 1:
12602  * sum_star[0] = nodeArray0[node, 0]
12603  */
12604  }
12605 
12606  /* "mprans/MeshSmoothing.pyx":794
12607  * nNodes = 1
12608  * fixed_node = True
12609  * if fixed_node is False: # <<<<<<<<<<<<<<
12610  * if nd == 2:
12611  * cyFindBoundaryDirectionTriangle(dir_=fixed_dir,
12612  */
12613  __pyx_t_1 = ((__pyx_v_fixed_node == 0) != 0);
12614  if (__pyx_t_1) {
12615 
12616  /* "mprans/MeshSmoothing.pyx":795
12617  * fixed_node = True
12618  * if fixed_node is False:
12619  * if nd == 2: # <<<<<<<<<<<<<<
12620  * cyFindBoundaryDirectionTriangle(dir_=fixed_dir,
12621  * node=node,
12622  */
12623  __pyx_t_1 = ((__pyx_v_nd == 2) != 0);
12624  if (__pyx_t_1) {
12625 
12626  /* "mprans/MeshSmoothing.pyx":796
12627  * if fixed_node is False:
12628  * if nd == 2:
12629  * cyFindBoundaryDirectionTriangle(dir_=fixed_dir, # <<<<<<<<<<<<<<
12630  * node=node,
12631  * nodeArray=nodeArray_,
12632  */
12633  __pyx_f_6mprans_13MeshSmoothing_cyFindBoundaryDirectionTriangle(__pyx_v_fixed_dir, __pyx_v_node, __pyx_v_nodeArray_, __pyx_v_nodeStarOffsets, __pyx_v_nodeStarArray, __pyx_v_nodeMaterialTypes);
12634 
12635  /* "mprans/MeshSmoothing.pyx":795
12636  * fixed_node = True
12637  * if fixed_node is False:
12638  * if nd == 2: # <<<<<<<<<<<<<<
12639  * cyFindBoundaryDirectionTriangle(dir_=fixed_dir,
12640  * node=node,
12641  */
12642  }
12643 
12644  /* "mprans/MeshSmoothing.pyx":802
12645  * nodeStarArray=nodeStarArray,
12646  * nodeMaterialTypes=nodeMaterialTypes)
12647  * if nd == 3: # <<<<<<<<<<<<<<
12648  * cyFindBoundaryDirectionTetra(dir_=fixed_dir,
12649  * node=node,
12650  */
12651  __pyx_t_1 = ((__pyx_v_nd == 3) != 0);
12652  if (__pyx_t_1) {
12653 
12654  /* "mprans/MeshSmoothing.pyx":803
12655  * nodeMaterialTypes=nodeMaterialTypes)
12656  * if nd == 3:
12657  * cyFindBoundaryDirectionTetra(dir_=fixed_dir, # <<<<<<<<<<<<<<
12658  * node=node,
12659  * nodeArray=nodeArray_,
12660  */
12661  __pyx_f_6mprans_13MeshSmoothing_cyFindBoundaryDirectionTetra(__pyx_v_fixed_dir, __pyx_v_node, __pyx_v_nodeArray_, __pyx_v_nodeStarOffsets, __pyx_v_nodeStarArray, __pyx_v_nodeMaterialTypes);
12662 
12663  /* "mprans/MeshSmoothing.pyx":802
12664  * nodeStarArray=nodeStarArray,
12665  * nodeMaterialTypes=nodeMaterialTypes)
12666  * if nd == 3: # <<<<<<<<<<<<<<
12667  * cyFindBoundaryDirectionTetra(dir_=fixed_dir,
12668  * node=node,
12669  */
12670  }
12671 
12672  /* "mprans/MeshSmoothing.pyx":810
12673  * nodeMaterialTypes=nodeMaterialTypes)
12674  * for nOffset in range(nodeStarOffsets[node],
12675  * nodeStarOffsets[node+1]): # <<<<<<<<<<<<<<
12676  * if simultaneous is True:
12677  * sum_star[0] += nodeArray0[nodeStarArray[nOffset], 0]
12678  */
12679  __pyx_t_49 = (__pyx_v_node + 1);
12680  if (__pyx_t_49 < 0) __pyx_t_49 += __pyx_v_nodeStarOffsets.shape[0];
12681  __pyx_t_13 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarOffsets.data + __pyx_t_49 * __pyx_v_nodeStarOffsets.strides[0]) )));
12682 
12683  /* "mprans/MeshSmoothing.pyx":809
12684  * nodeStarArray=nodeStarArray,
12685  * nodeMaterialTypes=nodeMaterialTypes)
12686  * for nOffset in range(nodeStarOffsets[node], # <<<<<<<<<<<<<<
12687  * nodeStarOffsets[node+1]):
12688  * if simultaneous is True:
12689  */
12690  __pyx_t_50 = __pyx_v_node;
12691  if (__pyx_t_50 < 0) __pyx_t_50 += __pyx_v_nodeStarOffsets.shape[0];
12692 
12693  /* "mprans/MeshSmoothing.pyx":810
12694  * nodeMaterialTypes=nodeMaterialTypes)
12695  * for nOffset in range(nodeStarOffsets[node],
12696  * nodeStarOffsets[node+1]): # <<<<<<<<<<<<<<
12697  * if simultaneous is True:
12698  * sum_star[0] += nodeArray0[nodeStarArray[nOffset], 0]
12699  */
12700  __pyx_t_15 = __pyx_t_13;
12701  for (__pyx_t_16 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarOffsets.data + __pyx_t_50 * __pyx_v_nodeStarOffsets.strides[0]) ))); __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
12702 
12703  /* "mprans/MeshSmoothing.pyx":809
12704  * nodeStarArray=nodeStarArray,
12705  * nodeMaterialTypes=nodeMaterialTypes)
12706  * for nOffset in range(nodeStarOffsets[node], # <<<<<<<<<<<<<<
12707  * nodeStarOffsets[node+1]):
12708  * if simultaneous is True:
12709  */
12710  __pyx_v_nOffset = __pyx_t_16;
12711 
12712  /* "mprans/MeshSmoothing.pyx":811
12713  * for nOffset in range(nodeStarOffsets[node],
12714  * nodeStarOffsets[node+1]):
12715  * if simultaneous is True: # <<<<<<<<<<<<<<
12716  * sum_star[0] += nodeArray0[nodeStarArray[nOffset], 0]
12717  * sum_star[1] += nodeArray0[nodeStarArray[nOffset], 1]
12718  */
12719  __pyx_t_1 = ((__pyx_v_simultaneous == 1) != 0);
12720  if (__pyx_t_1) {
12721 
12722  /* "mprans/MeshSmoothing.pyx":812
12723  * nodeStarOffsets[node+1]):
12724  * if simultaneous is True:
12725  * sum_star[0] += nodeArray0[nodeStarArray[nOffset], 0] # <<<<<<<<<<<<<<
12726  * sum_star[1] += nodeArray0[nodeStarArray[nOffset], 1]
12727  * sum_star[2] += nodeArray0[nodeStarArray[nOffset], 2]
12728  */
12729  __pyx_t_17 = 0;
12730  __pyx_t_51 = __pyx_v_nOffset;
12731  if (__pyx_t_51 < 0) __pyx_t_51 += __pyx_v_nodeStarArray.shape[0];
12732  __pyx_t_52 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_51 * __pyx_v_nodeStarArray.strides[0]) )));
12733  __pyx_t_53 = 0;
12734  if (__pyx_t_52 < 0) __pyx_t_52 += __pyx_v_nodeArray0.shape[0];
12735  if (__pyx_t_53 < 0) __pyx_t_53 += __pyx_v_nodeArray0.shape[1];
12736  (__pyx_v_sum_star[__pyx_t_17]) = ((__pyx_v_sum_star[__pyx_t_17]) + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray0.data + __pyx_t_52 * __pyx_v_nodeArray0.strides[0]) ) + __pyx_t_53 * __pyx_v_nodeArray0.strides[1]) ))));
12737 
12738  /* "mprans/MeshSmoothing.pyx":813
12739  * if simultaneous is True:
12740  * sum_star[0] += nodeArray0[nodeStarArray[nOffset], 0]
12741  * sum_star[1] += nodeArray0[nodeStarArray[nOffset], 1] # <<<<<<<<<<<<<<
12742  * sum_star[2] += nodeArray0[nodeStarArray[nOffset], 2]
12743  * else:
12744  */
12745  __pyx_t_17 = 1;
12746  __pyx_t_54 = __pyx_v_nOffset;
12747  if (__pyx_t_54 < 0) __pyx_t_54 += __pyx_v_nodeStarArray.shape[0];
12748  __pyx_t_55 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_54 * __pyx_v_nodeStarArray.strides[0]) )));
12749  __pyx_t_56 = 1;
12750  if (__pyx_t_55 < 0) __pyx_t_55 += __pyx_v_nodeArray0.shape[0];
12751  if (__pyx_t_56 < 0) __pyx_t_56 += __pyx_v_nodeArray0.shape[1];
12752  (__pyx_v_sum_star[__pyx_t_17]) = ((__pyx_v_sum_star[__pyx_t_17]) + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray0.data + __pyx_t_55 * __pyx_v_nodeArray0.strides[0]) ) + __pyx_t_56 * __pyx_v_nodeArray0.strides[1]) ))));
12753 
12754  /* "mprans/MeshSmoothing.pyx":814
12755  * sum_star[0] += nodeArray0[nodeStarArray[nOffset], 0]
12756  * sum_star[1] += nodeArray0[nodeStarArray[nOffset], 1]
12757  * sum_star[2] += nodeArray0[nodeStarArray[nOffset], 2] # <<<<<<<<<<<<<<
12758  * else:
12759  * sum_star[0] += nodeArray_[nodeStarArray[nOffset], 0]
12760  */
12761  __pyx_t_17 = 2;
12762  __pyx_t_57 = __pyx_v_nOffset;
12763  if (__pyx_t_57 < 0) __pyx_t_57 += __pyx_v_nodeStarArray.shape[0];
12764  __pyx_t_58 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_57 * __pyx_v_nodeStarArray.strides[0]) )));
12765  __pyx_t_59 = 2;
12766  if (__pyx_t_58 < 0) __pyx_t_58 += __pyx_v_nodeArray0.shape[0];
12767  if (__pyx_t_59 < 0) __pyx_t_59 += __pyx_v_nodeArray0.shape[1];
12768  (__pyx_v_sum_star[__pyx_t_17]) = ((__pyx_v_sum_star[__pyx_t_17]) + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray0.data + __pyx_t_58 * __pyx_v_nodeArray0.strides[0]) ) + __pyx_t_59 * __pyx_v_nodeArray0.strides[1]) ))));
12769 
12770  /* "mprans/MeshSmoothing.pyx":811
12771  * for nOffset in range(nodeStarOffsets[node],
12772  * nodeStarOffsets[node+1]):
12773  * if simultaneous is True: # <<<<<<<<<<<<<<
12774  * sum_star[0] += nodeArray0[nodeStarArray[nOffset], 0]
12775  * sum_star[1] += nodeArray0[nodeStarArray[nOffset], 1]
12776  */
12777  goto __pyx_L19;
12778  }
12779 
12780  /* "mprans/MeshSmoothing.pyx":816
12781  * sum_star[2] += nodeArray0[nodeStarArray[nOffset], 2]
12782  * else:
12783  * sum_star[0] += nodeArray_[nodeStarArray[nOffset], 0] # <<<<<<<<<<<<<<
12784  * sum_star[1] += nodeArray_[nodeStarArray[nOffset], 1]
12785  * sum_star[2] += nodeArray_[nodeStarArray[nOffset], 2]
12786  */
12787  /*else*/ {
12788  __pyx_t_17 = 0;
12789  __pyx_t_60 = __pyx_v_nOffset;
12790  if (__pyx_t_60 < 0) __pyx_t_60 += __pyx_v_nodeStarArray.shape[0];
12791  __pyx_t_61 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_60 * __pyx_v_nodeStarArray.strides[0]) )));
12792  __pyx_t_62 = 0;
12793  if (__pyx_t_61 < 0) __pyx_t_61 += __pyx_v_nodeArray_.shape[0];
12794  if (__pyx_t_62 < 0) __pyx_t_62 += __pyx_v_nodeArray_.shape[1];
12795  (__pyx_v_sum_star[__pyx_t_17]) = ((__pyx_v_sum_star[__pyx_t_17]) + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_61 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_62 * __pyx_v_nodeArray_.strides[1]) ))));
12796 
12797  /* "mprans/MeshSmoothing.pyx":817
12798  * else:
12799  * sum_star[0] += nodeArray_[nodeStarArray[nOffset], 0]
12800  * sum_star[1] += nodeArray_[nodeStarArray[nOffset], 1] # <<<<<<<<<<<<<<
12801  * sum_star[2] += nodeArray_[nodeStarArray[nOffset], 2]
12802  * nNodes += 1
12803  */
12804  __pyx_t_17 = 1;
12805  __pyx_t_63 = __pyx_v_nOffset;
12806  if (__pyx_t_63 < 0) __pyx_t_63 += __pyx_v_nodeStarArray.shape[0];
12807  __pyx_t_64 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_63 * __pyx_v_nodeStarArray.strides[0]) )));
12808  __pyx_t_65 = 1;
12809  if (__pyx_t_64 < 0) __pyx_t_64 += __pyx_v_nodeArray_.shape[0];
12810  if (__pyx_t_65 < 0) __pyx_t_65 += __pyx_v_nodeArray_.shape[1];
12811  (__pyx_v_sum_star[__pyx_t_17]) = ((__pyx_v_sum_star[__pyx_t_17]) + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_64 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_65 * __pyx_v_nodeArray_.strides[1]) ))));
12812 
12813  /* "mprans/MeshSmoothing.pyx":818
12814  * sum_star[0] += nodeArray_[nodeStarArray[nOffset], 0]
12815  * sum_star[1] += nodeArray_[nodeStarArray[nOffset], 1]
12816  * sum_star[2] += nodeArray_[nodeStarArray[nOffset], 2] # <<<<<<<<<<<<<<
12817  * nNodes += 1
12818  * nodeArray_[node, 0] += (sum_star[0]/nNodes-nodeArray_[node, 0])*fixed_dir[0]
12819  */
12820  __pyx_t_17 = 2;
12821  __pyx_t_66 = __pyx_v_nOffset;
12822  if (__pyx_t_66 < 0) __pyx_t_66 += __pyx_v_nodeStarArray.shape[0];
12823  __pyx_t_67 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_66 * __pyx_v_nodeStarArray.strides[0]) )));
12824  __pyx_t_68 = 2;
12825  if (__pyx_t_67 < 0) __pyx_t_67 += __pyx_v_nodeArray_.shape[0];
12826  if (__pyx_t_68 < 0) __pyx_t_68 += __pyx_v_nodeArray_.shape[1];
12827  (__pyx_v_sum_star[__pyx_t_17]) = ((__pyx_v_sum_star[__pyx_t_17]) + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_67 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_68 * __pyx_v_nodeArray_.strides[1]) ))));
12828  }
12829  __pyx_L19:;
12830 
12831  /* "mprans/MeshSmoothing.pyx":819
12832  * sum_star[1] += nodeArray_[nodeStarArray[nOffset], 1]
12833  * sum_star[2] += nodeArray_[nodeStarArray[nOffset], 2]
12834  * nNodes += 1 # <<<<<<<<<<<<<<
12835  * nodeArray_[node, 0] += (sum_star[0]/nNodes-nodeArray_[node, 0])*fixed_dir[0]
12836  * nodeArray_[node, 1] += (sum_star[1]/nNodes-nodeArray_[node, 1])*fixed_dir[1]
12837  */
12838  __pyx_v_nNodes = (__pyx_v_nNodes + 1);
12839  }
12840 
12841  /* "mprans/MeshSmoothing.pyx":794
12842  * nNodes = 1
12843  * fixed_node = True
12844  * if fixed_node is False: # <<<<<<<<<<<<<<
12845  * if nd == 2:
12846  * cyFindBoundaryDirectionTriangle(dir_=fixed_dir,
12847  */
12848  }
12849 
12850  /* "mprans/MeshSmoothing.pyx":820
12851  * sum_star[2] += nodeArray_[nodeStarArray[nOffset], 2]
12852  * nNodes += 1
12853  * nodeArray_[node, 0] += (sum_star[0]/nNodes-nodeArray_[node, 0])*fixed_dir[0] # <<<<<<<<<<<<<<
12854  * nodeArray_[node, 1] += (sum_star[1]/nNodes-nodeArray_[node, 1])*fixed_dir[1]
12855  * nodeArray_[node, 2] += (sum_star[2]/nNodes-nodeArray_[node, 2])*fixed_dir[2]
12856  */
12857  __pyx_t_69 = __pyx_v_node;
12858  __pyx_t_70 = 0;
12859  if (__pyx_t_69 < 0) __pyx_t_69 += __pyx_v_nodeArray_.shape[0];
12860  if (__pyx_t_70 < 0) __pyx_t_70 += __pyx_v_nodeArray_.shape[1];
12861  __pyx_t_71 = 0;
12862  if (__pyx_t_71 < 0) __pyx_t_71 += __pyx_v_fixed_dir.shape[0];
12863  __pyx_t_72 = __pyx_v_node;
12864  __pyx_t_73 = 0;
12865  if (__pyx_t_72 < 0) __pyx_t_72 += __pyx_v_nodeArray_.shape[0];
12866  if (__pyx_t_73 < 0) __pyx_t_73 += __pyx_v_nodeArray_.shape[1];
12867  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_72 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_73 * __pyx_v_nodeArray_.strides[1]) )) += ((((__pyx_v_sum_star[0]) / __pyx_v_nNodes) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_69 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_70 * __pyx_v_nodeArray_.strides[1]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_fixed_dir.data + __pyx_t_71 * __pyx_v_fixed_dir.strides[0]) ))));
12868 
12869  /* "mprans/MeshSmoothing.pyx":821
12870  * nNodes += 1
12871  * nodeArray_[node, 0] += (sum_star[0]/nNodes-nodeArray_[node, 0])*fixed_dir[0]
12872  * nodeArray_[node, 1] += (sum_star[1]/nNodes-nodeArray_[node, 1])*fixed_dir[1] # <<<<<<<<<<<<<<
12873  * nodeArray_[node, 2] += (sum_star[2]/nNodes-nodeArray_[node, 2])*fixed_dir[2]
12874  * else:
12875  */
12876  __pyx_t_74 = __pyx_v_node;
12877  __pyx_t_75 = 1;
12878  if (__pyx_t_74 < 0) __pyx_t_74 += __pyx_v_nodeArray_.shape[0];
12879  if (__pyx_t_75 < 0) __pyx_t_75 += __pyx_v_nodeArray_.shape[1];
12880  __pyx_t_76 = 1;
12881  if (__pyx_t_76 < 0) __pyx_t_76 += __pyx_v_fixed_dir.shape[0];
12882  __pyx_t_77 = __pyx_v_node;
12883  __pyx_t_78 = 1;
12884  if (__pyx_t_77 < 0) __pyx_t_77 += __pyx_v_nodeArray_.shape[0];
12885  if (__pyx_t_78 < 0) __pyx_t_78 += __pyx_v_nodeArray_.shape[1];
12886  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_77 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_78 * __pyx_v_nodeArray_.strides[1]) )) += ((((__pyx_v_sum_star[1]) / __pyx_v_nNodes) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_74 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_75 * __pyx_v_nodeArray_.strides[1]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_fixed_dir.data + __pyx_t_76 * __pyx_v_fixed_dir.strides[0]) ))));
12887 
12888  /* "mprans/MeshSmoothing.pyx":822
12889  * nodeArray_[node, 0] += (sum_star[0]/nNodes-nodeArray_[node, 0])*fixed_dir[0]
12890  * nodeArray_[node, 1] += (sum_star[1]/nNodes-nodeArray_[node, 1])*fixed_dir[1]
12891  * nodeArray_[node, 2] += (sum_star[2]/nNodes-nodeArray_[node, 2])*fixed_dir[2] # <<<<<<<<<<<<<<
12892  * else:
12893  * sum_star[0] = nodeArray0[node, 0]
12894  */
12895  __pyx_t_79 = __pyx_v_node;
12896  __pyx_t_80 = 2;
12897  if (__pyx_t_79 < 0) __pyx_t_79 += __pyx_v_nodeArray_.shape[0];
12898  if (__pyx_t_80 < 0) __pyx_t_80 += __pyx_v_nodeArray_.shape[1];
12899  __pyx_t_81 = 2;
12900  if (__pyx_t_81 < 0) __pyx_t_81 += __pyx_v_fixed_dir.shape[0];
12901  __pyx_t_82 = __pyx_v_node;
12902  __pyx_t_83 = 2;
12903  if (__pyx_t_82 < 0) __pyx_t_82 += __pyx_v_nodeArray_.shape[0];
12904  if (__pyx_t_83 < 0) __pyx_t_83 += __pyx_v_nodeArray_.shape[1];
12905  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_82 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_83 * __pyx_v_nodeArray_.strides[1]) )) += ((((__pyx_v_sum_star[2]) / __pyx_v_nNodes) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_79 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_80 * __pyx_v_nodeArray_.strides[1]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_fixed_dir.data + __pyx_t_81 * __pyx_v_fixed_dir.strides[0]) ))));
12906 
12907  /* "mprans/MeshSmoothing.pyx":784
12908  * nodeArray_[node, 2] = sum_star[2]/nNodes
12909  * # boundary smoothing not ready yet
12910  * elif smoothBoundaries is True: # <<<<<<<<<<<<<<
12911  * # smooth on boundary only
12912  * fixed_node = False
12913  */
12914  goto __pyx_L8;
12915  }
12916 
12917  /* "mprans/MeshSmoothing.pyx":824
12918  * nodeArray_[node, 2] += (sum_star[2]/nNodes-nodeArray_[node, 2])*fixed_dir[2]
12919  * else:
12920  * sum_star[0] = nodeArray0[node, 0] # <<<<<<<<<<<<<<
12921  * sum_star[1] = nodeArray0[node, 1]
12922  * sum_star[2] = nodeArray0[node, 2]
12923  */
12924  /*else*/ {
12925  __pyx_t_84 = __pyx_v_node;
12926  __pyx_t_85 = 0;
12927  if (__pyx_t_84 < 0) __pyx_t_84 += __pyx_v_nodeArray0.shape[0];
12928  if (__pyx_t_85 < 0) __pyx_t_85 += __pyx_v_nodeArray0.shape[1];
12929  (__pyx_v_sum_star[0]) = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray0.data + __pyx_t_84 * __pyx_v_nodeArray0.strides[0]) ) + __pyx_t_85 * __pyx_v_nodeArray0.strides[1]) )));
12930 
12931  /* "mprans/MeshSmoothing.pyx":825
12932  * else:
12933  * sum_star[0] = nodeArray0[node, 0]
12934  * sum_star[1] = nodeArray0[node, 1] # <<<<<<<<<<<<<<
12935  * sum_star[2] = nodeArray0[node, 2]
12936  * nNodes = 1
12937  */
12938  __pyx_t_86 = __pyx_v_node;
12939  __pyx_t_87 = 1;
12940  if (__pyx_t_86 < 0) __pyx_t_86 += __pyx_v_nodeArray0.shape[0];
12941  if (__pyx_t_87 < 0) __pyx_t_87 += __pyx_v_nodeArray0.shape[1];
12942  (__pyx_v_sum_star[1]) = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray0.data + __pyx_t_86 * __pyx_v_nodeArray0.strides[0]) ) + __pyx_t_87 * __pyx_v_nodeArray0.strides[1]) )));
12943 
12944  /* "mprans/MeshSmoothing.pyx":826
12945  * sum_star[0] = nodeArray0[node, 0]
12946  * sum_star[1] = nodeArray0[node, 1]
12947  * sum_star[2] = nodeArray0[node, 2] # <<<<<<<<<<<<<<
12948  * nNodes = 1
12949  * fixed_node = True
12950  */
12951  __pyx_t_88 = __pyx_v_node;
12952  __pyx_t_89 = 2;
12953  if (__pyx_t_88 < 0) __pyx_t_88 += __pyx_v_nodeArray0.shape[0];
12954  if (__pyx_t_89 < 0) __pyx_t_89 += __pyx_v_nodeArray0.shape[1];
12955  (__pyx_v_sum_star[2]) = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray0.data + __pyx_t_88 * __pyx_v_nodeArray0.strides[0]) ) + __pyx_t_89 * __pyx_v_nodeArray0.strides[1]) )));
12956 
12957  /* "mprans/MeshSmoothing.pyx":827
12958  * sum_star[1] = nodeArray0[node, 1]
12959  * sum_star[2] = nodeArray0[node, 2]
12960  * nNodes = 1 # <<<<<<<<<<<<<<
12961  * fixed_node = True
12962  * # if alpha != 0:
12963  */
12964  __pyx_v_nNodes = 1;
12965 
12966  /* "mprans/MeshSmoothing.pyx":828
12967  * sum_star[2] = nodeArray0[node, 2]
12968  * nNodes = 1
12969  * fixed_node = True # <<<<<<<<<<<<<<
12970  * # if alpha != 0:
12971  * # nodeArray_[node, 0] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[0]/nNodes
12972  */
12973  __pyx_v_fixed_node = 1;
12974  }
12975  __pyx_L8:;
12976  }
12977 
12978  /* "mprans/MeshSmoothing.pyx":741
12979  * ### Cython implementation of functions above
12980  *
12981  * cdef void cySmoothNodesLaplace(double[:,:] nodeArray_, # <<<<<<<<<<<<<<
12982  * int[:] nodeStarOffsets,
12983  * int[:] nodeStarArray,
12984  */
12985 
12986  /* function exit code */
12987  goto __pyx_L0;
12988  __pyx_L1_error:;
12989  __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
12990  __Pyx_XDECREF(__pyx_t_4);
12991  __Pyx_XDECREF(__pyx_t_5);
12992  __Pyx_XDECREF(__pyx_t_6);
12993  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
12994  __Pyx_WriteUnraisable("mprans.MeshSmoothing.cySmoothNodesLaplace", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
12995  __pyx_L0:;
12996  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray0, 1);
12997  __PYX_XDEC_MEMVIEW(&__pyx_v_fixed_dir, 1);
12998  __Pyx_RefNannyFinishContext();
12999 }
13000 
13001 /* "mprans/MeshSmoothing.pyx":834
13002  * # nodeArray_[node, 2] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[2]/nNodes
13003  *
13004  * cdef void cySmoothNodesCentroid(double[:,:] nodeArray_, # <<<<<<<<<<<<<<
13005  * int[:] nodeElementOffsets,
13006  * int[:] nodeElementsArray,
13007  */
13008 
13009 static void __pyx_f_6mprans_13MeshSmoothing_cySmoothNodesCentroid(__Pyx_memviewslice __pyx_v_nodeArray_, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_nodeMaterialTypes, __Pyx_memviewslice __pyx_v_elementVolumesArray, __Pyx_memviewslice __pyx_v_elementBarycentersArray, __Pyx_memviewslice __pyx_v_elementNodesArray, int __pyx_v_nNodes_owned, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_fixedNodesBoolArray, struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesCentroid *__pyx_optional_args) {
13010 
13011  /* "mprans/MeshSmoothing.pyx":843
13012  * int nNodes_owned,
13013  * int[:] fixedNodesBoolArray,
13014  * bool simultaneous=False, # <<<<<<<<<<<<<<
13015  * bool smoothBoundaries = True,
13016  * double alpha=0.):
13017  */
13018  bool __pyx_v_simultaneous = ((bool)0);
13019  double __pyx_v_alpha = ((double)0.);
13020  __Pyx_memviewslice __pyx_v_nodeArray0 = { 0, 0, { 0 }, { 0 }, { 0 } };
13021  double __pyx_v_sum_star[3];
13022  double __pyx_v_areas;
13023  CYTHON_UNUSED int __pyx_v_nNodes_star;
13024  CYTHON_UNUSED double __pyx_v_var;
13025  __Pyx_memviewslice __pyx_v_nA = { 0, 0, { 0 }, { 0 }, { 0 } };
13026  __Pyx_memviewslice __pyx_v_nB = { 0, 0, { 0 }, { 0 }, { 0 } };
13027  __Pyx_memviewslice __pyx_v_nC = { 0, 0, { 0 }, { 0 }, { 0 } };
13028  int __pyx_v_node;
13029  int __pyx_v_eOffset;
13030  int __pyx_v_eN;
13031  __Pyx_RefNannyDeclarations
13032  int __pyx_t_1;
13033  int __pyx_t_2;
13034  __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
13035  int __pyx_t_4;
13036  int __pyx_t_5;
13037  int __pyx_t_6;
13038  Py_ssize_t __pyx_t_7;
13039  Py_ssize_t __pyx_t_8;
13040  int __pyx_t_9;
13041  Py_ssize_t __pyx_t_10;
13042  int __pyx_t_11;
13043  int __pyx_t_12;
13044  Py_ssize_t __pyx_t_13;
13045  long __pyx_t_14;
13046  Py_ssize_t __pyx_t_15;
13047  Py_ssize_t __pyx_t_16;
13048  Py_ssize_t __pyx_t_17;
13049  Py_ssize_t __pyx_t_18;
13050  Py_ssize_t __pyx_t_19;
13051  Py_ssize_t __pyx_t_20;
13052  Py_ssize_t __pyx_t_21;
13053  Py_ssize_t __pyx_t_22;
13054  Py_ssize_t __pyx_t_23;
13055  Py_ssize_t __pyx_t_24;
13056  Py_ssize_t __pyx_t_25;
13057  Py_ssize_t __pyx_t_26;
13058  Py_ssize_t __pyx_t_27;
13059  Py_ssize_t __pyx_t_28;
13060  Py_ssize_t __pyx_t_29;
13061  Py_ssize_t __pyx_t_30;
13062  Py_ssize_t __pyx_t_31;
13063  Py_ssize_t __pyx_t_32;
13064  Py_ssize_t __pyx_t_33;
13065  Py_ssize_t __pyx_t_34;
13066  Py_ssize_t __pyx_t_35;
13067  Py_ssize_t __pyx_t_36;
13068  Py_ssize_t __pyx_t_37;
13069  Py_ssize_t __pyx_t_38;
13070  Py_ssize_t __pyx_t_39;
13071  Py_ssize_t __pyx_t_40;
13072  Py_ssize_t __pyx_t_41;
13073  Py_ssize_t __pyx_t_42;
13074  Py_ssize_t __pyx_t_43;
13075  Py_ssize_t __pyx_t_44;
13076  Py_ssize_t __pyx_t_45;
13077  Py_ssize_t __pyx_t_46;
13078  Py_ssize_t __pyx_t_47;
13079  __Pyx_memviewslice __pyx_t_48 = { 0, 0, { 0 }, { 0 }, { 0 } };
13080  Py_ssize_t __pyx_t_49;
13081  Py_ssize_t __pyx_t_50;
13082  Py_ssize_t __pyx_t_51;
13083  Py_ssize_t __pyx_t_52;
13084  Py_ssize_t __pyx_t_53;
13085  Py_ssize_t __pyx_t_54;
13086  Py_ssize_t __pyx_t_55;
13087  Py_ssize_t __pyx_t_56;
13088  Py_ssize_t __pyx_t_57;
13089  Py_ssize_t __pyx_t_58;
13090  Py_ssize_t __pyx_t_59;
13091  Py_ssize_t __pyx_t_60;
13092  Py_ssize_t __pyx_t_61;
13093  Py_ssize_t __pyx_t_62;
13094  Py_ssize_t __pyx_t_63;
13095  Py_ssize_t __pyx_t_64;
13096  Py_ssize_t __pyx_t_65;
13097  Py_ssize_t __pyx_t_66;
13098  Py_ssize_t __pyx_t_67;
13099  Py_ssize_t __pyx_t_68;
13100  __Pyx_RefNannySetupContext("cySmoothNodesCentroid", 0);
13101  if (__pyx_optional_args) {
13102  if (__pyx_optional_args->__pyx_n > 0) {
13103  __pyx_v_simultaneous = __pyx_optional_args->simultaneous;
13104  if (__pyx_optional_args->__pyx_n > 2) {
13105  __pyx_v_alpha = __pyx_optional_args->alpha;
13106  }
13107  }
13108  }
13109 
13110  /* "mprans/MeshSmoothing.pyx":847
13111  * double alpha=0.):
13112  * cdef double[:,:] nodeArray0
13113  * if simultaneous or alpha != 0: # <<<<<<<<<<<<<<
13114  * nodeArray0 = nodeArray_.copy()
13115  * cdef double[3] sum_star
13116  */
13117  __pyx_t_2 = (__pyx_v_simultaneous != 0);
13118  if (!__pyx_t_2) {
13119  } else {
13120  __pyx_t_1 = __pyx_t_2;
13121  goto __pyx_L4_bool_binop_done;
13122  }
13123  __pyx_t_2 = ((__pyx_v_alpha != 0.0) != 0);
13124  __pyx_t_1 = __pyx_t_2;
13125  __pyx_L4_bool_binop_done:;
13126  if (__pyx_t_1) {
13127 
13128  /* "mprans/MeshSmoothing.pyx":848
13129  * cdef double[:,:] nodeArray0
13130  * if simultaneous or alpha != 0:
13131  * nodeArray0 = nodeArray_.copy() # <<<<<<<<<<<<<<
13132  * cdef double[3] sum_star
13133  * cdef int nNodeInStar
13134  */
13135  __pyx_t_3 = __pyx_memoryview_copy_slice_d_dc_double_c(__pyx_v_nodeArray_); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 848, __pyx_L1_error)
13136  __pyx_v_nodeArray0 = __pyx_t_3;
13137  __pyx_t_3.memview = NULL;
13138  __pyx_t_3.data = NULL;
13139 
13140  /* "mprans/MeshSmoothing.pyx":847
13141  * double alpha=0.):
13142  * cdef double[:,:] nodeArray0
13143  * if simultaneous or alpha != 0: # <<<<<<<<<<<<<<
13144  * nodeArray0 = nodeArray_.copy()
13145  * cdef double[3] sum_star
13146  */
13147  }
13148 
13149  /* "mprans/MeshSmoothing.pyx":851
13150  * cdef double[3] sum_star
13151  * cdef int nNodeInStar
13152  * cdef double areas = 0. # <<<<<<<<<<<<<<
13153  * cdef int nNodes_star = 0
13154  * cdef double[:] nodeOffset0
13155  */
13156  __pyx_v_areas = 0.;
13157 
13158  /* "mprans/MeshSmoothing.pyx":852
13159  * cdef int nNodeInStar
13160  * cdef double areas = 0.
13161  * cdef int nNodes_star = 0 # <<<<<<<<<<<<<<
13162  * cdef double[:] nodeOffset0
13163  * cdef double[:] nodeOffset1
13164  */
13165  __pyx_v_nNodes_star = 0;
13166 
13167  /* "mprans/MeshSmoothing.pyx":855
13168  * cdef double[:] nodeOffset0
13169  * cdef double[:] nodeOffset1
13170  * cdef double var = 0. # <<<<<<<<<<<<<<
13171  * cdef double[:] centroid_cell
13172  * cdef double[:] nA
13173  */
13174  __pyx_v_var = 0.;
13175 
13176  /* "mprans/MeshSmoothing.pyx":865
13177  * cdef int eOffset
13178  * cdef int eN
13179  * for node in range(nNodes_owned): # <<<<<<<<<<<<<<
13180  * sum_star[0] = 0.
13181  * sum_star[1] = 0.
13182  */
13183  __pyx_t_4 = __pyx_v_nNodes_owned;
13184  __pyx_t_5 = __pyx_t_4;
13185  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
13186  __pyx_v_node = __pyx_t_6;
13187 
13188  /* "mprans/MeshSmoothing.pyx":866
13189  * cdef int eN
13190  * for node in range(nNodes_owned):
13191  * sum_star[0] = 0. # <<<<<<<<<<<<<<
13192  * sum_star[1] = 0.
13193  * sum_star[2] = 0.
13194  */
13195  (__pyx_v_sum_star[0]) = 0.;
13196 
13197  /* "mprans/MeshSmoothing.pyx":867
13198  * for node in range(nNodes_owned):
13199  * sum_star[0] = 0.
13200  * sum_star[1] = 0. # <<<<<<<<<<<<<<
13201  * sum_star[2] = 0.
13202  * areas = 0.
13203  */
13204  (__pyx_v_sum_star[1]) = 0.;
13205 
13206  /* "mprans/MeshSmoothing.pyx":868
13207  * sum_star[0] = 0.
13208  * sum_star[1] = 0.
13209  * sum_star[2] = 0. # <<<<<<<<<<<<<<
13210  * areas = 0.
13211  * if nodeMaterialTypes[node] == 0:
13212  */
13213  (__pyx_v_sum_star[2]) = 0.;
13214 
13215  /* "mprans/MeshSmoothing.pyx":869
13216  * sum_star[1] = 0.
13217  * sum_star[2] = 0.
13218  * areas = 0. # <<<<<<<<<<<<<<
13219  * if nodeMaterialTypes[node] == 0:
13220  * for eOffset in range(nodeElementOffsets[node],
13221  */
13222  __pyx_v_areas = 0.;
13223 
13224  /* "mprans/MeshSmoothing.pyx":870
13225  * sum_star[2] = 0.
13226  * areas = 0.
13227  * if nodeMaterialTypes[node] == 0: # <<<<<<<<<<<<<<
13228  * for eOffset in range(nodeElementOffsets[node],
13229  * nodeElementOffsets[node+1]):
13230  */
13231  __pyx_t_7 = __pyx_v_node;
13232  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_nodeMaterialTypes.shape[0];
13233  __pyx_t_1 = (((*((int *) ( /* dim=0 */ (__pyx_v_nodeMaterialTypes.data + __pyx_t_7 * __pyx_v_nodeMaterialTypes.strides[0]) ))) == 0) != 0);
13234  if (__pyx_t_1) {
13235 
13236  /* "mprans/MeshSmoothing.pyx":872
13237  * if nodeMaterialTypes[node] == 0:
13238  * for eOffset in range(nodeElementOffsets[node],
13239  * nodeElementOffsets[node+1]): # <<<<<<<<<<<<<<
13240  * eN = nodeElementsArray[eOffset]
13241  * sum_star[0] += elementBarycentersArray[eN,0]*elementVolumesArray[eN]
13242  */
13243  __pyx_t_8 = (__pyx_v_node + 1);
13244  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_nodeElementOffsets.shape[0];
13245  __pyx_t_9 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_8 * __pyx_v_nodeElementOffsets.strides[0]) )));
13246 
13247  /* "mprans/MeshSmoothing.pyx":871
13248  * areas = 0.
13249  * if nodeMaterialTypes[node] == 0:
13250  * for eOffset in range(nodeElementOffsets[node], # <<<<<<<<<<<<<<
13251  * nodeElementOffsets[node+1]):
13252  * eN = nodeElementsArray[eOffset]
13253  */
13254  __pyx_t_10 = __pyx_v_node;
13255  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_nodeElementOffsets.shape[0];
13256 
13257  /* "mprans/MeshSmoothing.pyx":872
13258  * if nodeMaterialTypes[node] == 0:
13259  * for eOffset in range(nodeElementOffsets[node],
13260  * nodeElementOffsets[node+1]): # <<<<<<<<<<<<<<
13261  * eN = nodeElementsArray[eOffset]
13262  * sum_star[0] += elementBarycentersArray[eN,0]*elementVolumesArray[eN]
13263  */
13264  __pyx_t_11 = __pyx_t_9;
13265  for (__pyx_t_12 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_10 * __pyx_v_nodeElementOffsets.strides[0]) ))); __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
13266 
13267  /* "mprans/MeshSmoothing.pyx":871
13268  * areas = 0.
13269  * if nodeMaterialTypes[node] == 0:
13270  * for eOffset in range(nodeElementOffsets[node], # <<<<<<<<<<<<<<
13271  * nodeElementOffsets[node+1]):
13272  * eN = nodeElementsArray[eOffset]
13273  */
13274  __pyx_v_eOffset = __pyx_t_12;
13275 
13276  /* "mprans/MeshSmoothing.pyx":873
13277  * for eOffset in range(nodeElementOffsets[node],
13278  * nodeElementOffsets[node+1]):
13279  * eN = nodeElementsArray[eOffset] # <<<<<<<<<<<<<<
13280  * sum_star[0] += elementBarycentersArray[eN,0]*elementVolumesArray[eN]
13281  * sum_star[1] += elementBarycentersArray[eN,1]*elementVolumesArray[eN]
13282  */
13283  __pyx_t_13 = __pyx_v_eOffset;
13284  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_nodeElementsArray.shape[0];
13285  __pyx_v_eN = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementsArray.data + __pyx_t_13 * __pyx_v_nodeElementsArray.strides[0]) )));
13286 
13287  /* "mprans/MeshSmoothing.pyx":874
13288  * nodeElementOffsets[node+1]):
13289  * eN = nodeElementsArray[eOffset]
13290  * sum_star[0] += elementBarycentersArray[eN,0]*elementVolumesArray[eN] # <<<<<<<<<<<<<<
13291  * sum_star[1] += elementBarycentersArray[eN,1]*elementVolumesArray[eN]
13292  * sum_star[2] += elementBarycentersArray[eN,2]*elementVolumesArray[eN]
13293  */
13294  __pyx_t_14 = 0;
13295  __pyx_t_15 = __pyx_v_eN;
13296  __pyx_t_16 = 0;
13297  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_elementBarycentersArray.shape[0];
13298  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_elementBarycentersArray.shape[1];
13299  __pyx_t_17 = __pyx_v_eN;
13300  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_elementVolumesArray.shape[0];
13301  (__pyx_v_sum_star[__pyx_t_14]) = ((__pyx_v_sum_star[__pyx_t_14]) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray.data + __pyx_t_15 * __pyx_v_elementBarycentersArray.strides[0]) ) + __pyx_t_16 * __pyx_v_elementBarycentersArray.strides[1]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_elementVolumesArray.data + __pyx_t_17 * __pyx_v_elementVolumesArray.strides[0]) )))));
13302 
13303  /* "mprans/MeshSmoothing.pyx":875
13304  * eN = nodeElementsArray[eOffset]
13305  * sum_star[0] += elementBarycentersArray[eN,0]*elementVolumesArray[eN]
13306  * sum_star[1] += elementBarycentersArray[eN,1]*elementVolumesArray[eN] # <<<<<<<<<<<<<<
13307  * sum_star[2] += elementBarycentersArray[eN,2]*elementVolumesArray[eN]
13308  * areas += elementVolumesArray[eN]
13309  */
13310  __pyx_t_14 = 1;
13311  __pyx_t_18 = __pyx_v_eN;
13312  __pyx_t_19 = 1;
13313  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_elementBarycentersArray.shape[0];
13314  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_elementBarycentersArray.shape[1];
13315  __pyx_t_20 = __pyx_v_eN;
13316  if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_elementVolumesArray.shape[0];
13317  (__pyx_v_sum_star[__pyx_t_14]) = ((__pyx_v_sum_star[__pyx_t_14]) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray.data + __pyx_t_18 * __pyx_v_elementBarycentersArray.strides[0]) ) + __pyx_t_19 * __pyx_v_elementBarycentersArray.strides[1]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_elementVolumesArray.data + __pyx_t_20 * __pyx_v_elementVolumesArray.strides[0]) )))));
13318 
13319  /* "mprans/MeshSmoothing.pyx":876
13320  * sum_star[0] += elementBarycentersArray[eN,0]*elementVolumesArray[eN]
13321  * sum_star[1] += elementBarycentersArray[eN,1]*elementVolumesArray[eN]
13322  * sum_star[2] += elementBarycentersArray[eN,2]*elementVolumesArray[eN] # <<<<<<<<<<<<<<
13323  * areas += elementVolumesArray[eN]
13324  * if alpha != 0:
13325  */
13326  __pyx_t_14 = 2;
13327  __pyx_t_21 = __pyx_v_eN;
13328  __pyx_t_22 = 2;
13329  if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_elementBarycentersArray.shape[0];
13330  if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_elementBarycentersArray.shape[1];
13331  __pyx_t_23 = __pyx_v_eN;
13332  if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_elementVolumesArray.shape[0];
13333  (__pyx_v_sum_star[__pyx_t_14]) = ((__pyx_v_sum_star[__pyx_t_14]) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray.data + __pyx_t_21 * __pyx_v_elementBarycentersArray.strides[0]) ) + __pyx_t_22 * __pyx_v_elementBarycentersArray.strides[1]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_elementVolumesArray.data + __pyx_t_23 * __pyx_v_elementVolumesArray.strides[0]) )))));
13334 
13335  /* "mprans/MeshSmoothing.pyx":877
13336  * sum_star[1] += elementBarycentersArray[eN,1]*elementVolumesArray[eN]
13337  * sum_star[2] += elementBarycentersArray[eN,2]*elementVolumesArray[eN]
13338  * areas += elementVolumesArray[eN] # <<<<<<<<<<<<<<
13339  * if alpha != 0:
13340  * nodeArray_[node, 0] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[0]/areas
13341  */
13342  __pyx_t_24 = __pyx_v_eN;
13343  if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_elementVolumesArray.shape[0];
13344  __pyx_v_areas = (__pyx_v_areas + (*((double *) ( /* dim=0 */ (__pyx_v_elementVolumesArray.data + __pyx_t_24 * __pyx_v_elementVolumesArray.strides[0]) ))));
13345  }
13346 
13347  /* "mprans/MeshSmoothing.pyx":878
13348  * sum_star[2] += elementBarycentersArray[eN,2]*elementVolumesArray[eN]
13349  * areas += elementVolumesArray[eN]
13350  * if alpha != 0: # <<<<<<<<<<<<<<
13351  * nodeArray_[node, 0] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[0]/areas
13352  * nodeArray_[node, 1] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[1]/areas
13353  */
13354  __pyx_t_1 = ((__pyx_v_alpha != 0.0) != 0);
13355  if (__pyx_t_1) {
13356 
13357  /* "mprans/MeshSmoothing.pyx":879
13358  * areas += elementVolumesArray[eN]
13359  * if alpha != 0:
13360  * nodeArray_[node, 0] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[0]/areas # <<<<<<<<<<<<<<
13361  * nodeArray_[node, 1] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[1]/areas
13362  * nodeArray_[node, 2] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[2]/areas
13363  */
13364  __pyx_t_25 = __pyx_v_node;
13365  __pyx_t_26 = 0;
13366  if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_nodeArray0.shape[0];
13367  if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_nodeArray0.shape[1];
13368  __pyx_t_27 = __pyx_v_node;
13369  __pyx_t_28 = 0;
13370  if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_nodeArray_.shape[0];
13371  if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_nodeArray_.shape[1];
13372  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_27 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_28 * __pyx_v_nodeArray_.strides[1]) )) = ((__pyx_v_alpha * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray0.data + __pyx_t_25 * __pyx_v_nodeArray0.strides[0]) ) + __pyx_t_26 * __pyx_v_nodeArray0.strides[1]) )))) + (((1.0 - __pyx_v_alpha) * (__pyx_v_sum_star[0])) / __pyx_v_areas));
13373 
13374  /* "mprans/MeshSmoothing.pyx":880
13375  * if alpha != 0:
13376  * nodeArray_[node, 0] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[0]/areas
13377  * nodeArray_[node, 1] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[1]/areas # <<<<<<<<<<<<<<
13378  * nodeArray_[node, 2] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[2]/areas
13379  * else:
13380  */
13381  __pyx_t_29 = __pyx_v_node;
13382  __pyx_t_30 = 0;
13383  if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_nodeArray0.shape[0];
13384  if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_nodeArray0.shape[1];
13385  __pyx_t_31 = __pyx_v_node;
13386  __pyx_t_32 = 1;
13387  if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_nodeArray_.shape[0];
13388  if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_nodeArray_.shape[1];
13389  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_31 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_32 * __pyx_v_nodeArray_.strides[1]) )) = ((__pyx_v_alpha * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray0.data + __pyx_t_29 * __pyx_v_nodeArray0.strides[0]) ) + __pyx_t_30 * __pyx_v_nodeArray0.strides[1]) )))) + (((1.0 - __pyx_v_alpha) * (__pyx_v_sum_star[1])) / __pyx_v_areas));
13390 
13391  /* "mprans/MeshSmoothing.pyx":881
13392  * nodeArray_[node, 0] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[0]/areas
13393  * nodeArray_[node, 1] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[1]/areas
13394  * nodeArray_[node, 2] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[2]/areas # <<<<<<<<<<<<<<
13395  * else:
13396  * nodeArray_[node, 0] = sum_star[0]/areas
13397  */
13398  __pyx_t_33 = __pyx_v_node;
13399  __pyx_t_34 = 0;
13400  if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_nodeArray0.shape[0];
13401  if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_nodeArray0.shape[1];
13402  __pyx_t_35 = __pyx_v_node;
13403  __pyx_t_36 = 2;
13404  if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_nodeArray_.shape[0];
13405  if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_nodeArray_.shape[1];
13406  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_35 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_36 * __pyx_v_nodeArray_.strides[1]) )) = ((__pyx_v_alpha * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray0.data + __pyx_t_33 * __pyx_v_nodeArray0.strides[0]) ) + __pyx_t_34 * __pyx_v_nodeArray0.strides[1]) )))) + (((1.0 - __pyx_v_alpha) * (__pyx_v_sum_star[2])) / __pyx_v_areas));
13407 
13408  /* "mprans/MeshSmoothing.pyx":878
13409  * sum_star[2] += elementBarycentersArray[eN,2]*elementVolumesArray[eN]
13410  * areas += elementVolumesArray[eN]
13411  * if alpha != 0: # <<<<<<<<<<<<<<
13412  * nodeArray_[node, 0] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[0]/areas
13413  * nodeArray_[node, 1] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[1]/areas
13414  */
13415  goto __pyx_L11;
13416  }
13417 
13418  /* "mprans/MeshSmoothing.pyx":883
13419  * nodeArray_[node, 2] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[2]/areas
13420  * else:
13421  * nodeArray_[node, 0] = sum_star[0]/areas # <<<<<<<<<<<<<<
13422  * nodeArray_[node, 1] = sum_star[1]/areas
13423  * nodeArray_[node, 2] = sum_star[2]/areas
13424  */
13425  /*else*/ {
13426  __pyx_t_37 = __pyx_v_node;
13427  __pyx_t_38 = 0;
13428  if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_nodeArray_.shape[0];
13429  if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_nodeArray_.shape[1];
13430  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_37 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_38 * __pyx_v_nodeArray_.strides[1]) )) = ((__pyx_v_sum_star[0]) / __pyx_v_areas);
13431 
13432  /* "mprans/MeshSmoothing.pyx":884
13433  * else:
13434  * nodeArray_[node, 0] = sum_star[0]/areas
13435  * nodeArray_[node, 1] = sum_star[1]/areas # <<<<<<<<<<<<<<
13436  * nodeArray_[node, 2] = sum_star[2]/areas
13437  * if not simultaneous:
13438  */
13439  __pyx_t_39 = __pyx_v_node;
13440  __pyx_t_40 = 1;
13441  if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_v_nodeArray_.shape[0];
13442  if (__pyx_t_40 < 0) __pyx_t_40 += __pyx_v_nodeArray_.shape[1];
13443  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_39 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_40 * __pyx_v_nodeArray_.strides[1]) )) = ((__pyx_v_sum_star[1]) / __pyx_v_areas);
13444 
13445  /* "mprans/MeshSmoothing.pyx":885
13446  * nodeArray_[node, 0] = sum_star[0]/areas
13447  * nodeArray_[node, 1] = sum_star[1]/areas
13448  * nodeArray_[node, 2] = sum_star[2]/areas # <<<<<<<<<<<<<<
13449  * if not simultaneous:
13450  * for eOffset in range(nodeElementOffsets[node],
13451  */
13452  __pyx_t_41 = __pyx_v_node;
13453  __pyx_t_42 = 2;
13454  if (__pyx_t_41 < 0) __pyx_t_41 += __pyx_v_nodeArray_.shape[0];
13455  if (__pyx_t_42 < 0) __pyx_t_42 += __pyx_v_nodeArray_.shape[1];
13456  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_41 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_42 * __pyx_v_nodeArray_.strides[1]) )) = ((__pyx_v_sum_star[2]) / __pyx_v_areas);
13457  }
13458  __pyx_L11:;
13459 
13460  /* "mprans/MeshSmoothing.pyx":886
13461  * nodeArray_[node, 1] = sum_star[1]/areas
13462  * nodeArray_[node, 2] = sum_star[2]/areas
13463  * if not simultaneous: # <<<<<<<<<<<<<<
13464  * for eOffset in range(nodeElementOffsets[node],
13465  * nodeElementOffsets[node+1]):
13466  */
13467  __pyx_t_1 = ((!(__pyx_v_simultaneous != 0)) != 0);
13468  if (__pyx_t_1) {
13469 
13470  /* "mprans/MeshSmoothing.pyx":888
13471  * if not simultaneous:
13472  * for eOffset in range(nodeElementOffsets[node],
13473  * nodeElementOffsets[node+1]): # <<<<<<<<<<<<<<
13474  * eN = nodeElementsArray[eOffset]
13475  * nA = nodeArray_[elementNodesArray[eN, 0]]
13476  */
13477  __pyx_t_43 = (__pyx_v_node + 1);
13478  if (__pyx_t_43 < 0) __pyx_t_43 += __pyx_v_nodeElementOffsets.shape[0];
13479  __pyx_t_9 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_43 * __pyx_v_nodeElementOffsets.strides[0]) )));
13480 
13481  /* "mprans/MeshSmoothing.pyx":887
13482  * nodeArray_[node, 2] = sum_star[2]/areas
13483  * if not simultaneous:
13484  * for eOffset in range(nodeElementOffsets[node], # <<<<<<<<<<<<<<
13485  * nodeElementOffsets[node+1]):
13486  * eN = nodeElementsArray[eOffset]
13487  */
13488  __pyx_t_44 = __pyx_v_node;
13489  if (__pyx_t_44 < 0) __pyx_t_44 += __pyx_v_nodeElementOffsets.shape[0];
13490 
13491  /* "mprans/MeshSmoothing.pyx":888
13492  * if not simultaneous:
13493  * for eOffset in range(nodeElementOffsets[node],
13494  * nodeElementOffsets[node+1]): # <<<<<<<<<<<<<<
13495  * eN = nodeElementsArray[eOffset]
13496  * nA = nodeArray_[elementNodesArray[eN, 0]]
13497  */
13498  __pyx_t_11 = __pyx_t_9;
13499  for (__pyx_t_12 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_44 * __pyx_v_nodeElementOffsets.strides[0]) ))); __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
13500 
13501  /* "mprans/MeshSmoothing.pyx":887
13502  * nodeArray_[node, 2] = sum_star[2]/areas
13503  * if not simultaneous:
13504  * for eOffset in range(nodeElementOffsets[node], # <<<<<<<<<<<<<<
13505  * nodeElementOffsets[node+1]):
13506  * eN = nodeElementsArray[eOffset]
13507  */
13508  __pyx_v_eOffset = __pyx_t_12;
13509 
13510  /* "mprans/MeshSmoothing.pyx":889
13511  * for eOffset in range(nodeElementOffsets[node],
13512  * nodeElementOffsets[node+1]):
13513  * eN = nodeElementsArray[eOffset] # <<<<<<<<<<<<<<
13514  * nA = nodeArray_[elementNodesArray[eN, 0]]
13515  * nB = nodeArray_[elementNodesArray[eN, 1]]
13516  */
13517  __pyx_t_45 = __pyx_v_eOffset;
13518  if (__pyx_t_45 < 0) __pyx_t_45 += __pyx_v_nodeElementsArray.shape[0];
13519  __pyx_v_eN = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementsArray.data + __pyx_t_45 * __pyx_v_nodeElementsArray.strides[0]) )));
13520 
13521  /* "mprans/MeshSmoothing.pyx":890
13522  * nodeElementOffsets[node+1]):
13523  * eN = nodeElementsArray[eOffset]
13524  * nA = nodeArray_[elementNodesArray[eN, 0]] # <<<<<<<<<<<<<<
13525  * nB = nodeArray_[elementNodesArray[eN, 1]]
13526  * nC = nodeArray_[elementNodesArray[eN, 2]]
13527  */
13528  __pyx_t_46 = __pyx_v_eN;
13529  __pyx_t_47 = 0;
13530  if (__pyx_t_46 < 0) __pyx_t_46 += __pyx_v_elementNodesArray.shape[0];
13531  if (__pyx_t_47 < 0) __pyx_t_47 += __pyx_v_elementNodesArray.shape[1];
13532  __pyx_t_48.data = __pyx_v_nodeArray_.data;
13533  __pyx_t_48.memview = __pyx_v_nodeArray_.memview;
13534  __PYX_INC_MEMVIEW(&__pyx_t_48, 0);
13535  {
13536  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_46 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_47 * __pyx_v_elementNodesArray.strides[1]) )));
13537  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray_.shape[0];
13538  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray_.strides[0];
13539  if (__pyx_tmp_idx < 0)
13540  __pyx_tmp_idx += __pyx_tmp_shape;
13541  if ((0)) __PYX_ERR(0, 890, __pyx_L1_error)
13542  __pyx_t_48.data += __pyx_tmp_idx * __pyx_tmp_stride;
13543 }
13544 
13545 __pyx_t_48.shape[0] = __pyx_v_nodeArray_.shape[1];
13546 __pyx_t_48.strides[0] = __pyx_v_nodeArray_.strides[1];
13547  __pyx_t_48.suboffsets[0] = -1;
13548 
13549 __PYX_XDEC_MEMVIEW(&__pyx_v_nA, 1);
13550  __pyx_v_nA = __pyx_t_48;
13551  __pyx_t_48.memview = NULL;
13552  __pyx_t_48.data = NULL;
13553 
13554  /* "mprans/MeshSmoothing.pyx":891
13555  * eN = nodeElementsArray[eOffset]
13556  * nA = nodeArray_[elementNodesArray[eN, 0]]
13557  * nB = nodeArray_[elementNodesArray[eN, 1]] # <<<<<<<<<<<<<<
13558  * nC = nodeArray_[elementNodesArray[eN, 2]]
13559  * elementVolumesArray[eN] = cyGetElementVolumeTriangle(nA, nB, nC)
13560  */
13561  __pyx_t_49 = __pyx_v_eN;
13562  __pyx_t_50 = 1;
13563  if (__pyx_t_49 < 0) __pyx_t_49 += __pyx_v_elementNodesArray.shape[0];
13564  if (__pyx_t_50 < 0) __pyx_t_50 += __pyx_v_elementNodesArray.shape[1];
13565  __pyx_t_48.data = __pyx_v_nodeArray_.data;
13566  __pyx_t_48.memview = __pyx_v_nodeArray_.memview;
13567  __PYX_INC_MEMVIEW(&__pyx_t_48, 0);
13568  {
13569  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_49 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_50 * __pyx_v_elementNodesArray.strides[1]) )));
13570  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray_.shape[0];
13571  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray_.strides[0];
13572  if (__pyx_tmp_idx < 0)
13573  __pyx_tmp_idx += __pyx_tmp_shape;
13574  if ((0)) __PYX_ERR(0, 891, __pyx_L1_error)
13575  __pyx_t_48.data += __pyx_tmp_idx * __pyx_tmp_stride;
13576 }
13577 
13578 __pyx_t_48.shape[0] = __pyx_v_nodeArray_.shape[1];
13579 __pyx_t_48.strides[0] = __pyx_v_nodeArray_.strides[1];
13580  __pyx_t_48.suboffsets[0] = -1;
13581 
13582 __PYX_XDEC_MEMVIEW(&__pyx_v_nB, 1);
13583  __pyx_v_nB = __pyx_t_48;
13584  __pyx_t_48.memview = NULL;
13585  __pyx_t_48.data = NULL;
13586 
13587  /* "mprans/MeshSmoothing.pyx":892
13588  * nA = nodeArray_[elementNodesArray[eN, 0]]
13589  * nB = nodeArray_[elementNodesArray[eN, 1]]
13590  * nC = nodeArray_[elementNodesArray[eN, 2]] # <<<<<<<<<<<<<<
13591  * elementVolumesArray[eN] = cyGetElementVolumeTriangle(nA, nB, nC)
13592  * elementBarycentersArray[eN, 0] = (nA[0]+nB[0]+nC[0])/3.
13593  */
13594  __pyx_t_51 = __pyx_v_eN;
13595  __pyx_t_52 = 2;
13596  if (__pyx_t_51 < 0) __pyx_t_51 += __pyx_v_elementNodesArray.shape[0];
13597  if (__pyx_t_52 < 0) __pyx_t_52 += __pyx_v_elementNodesArray.shape[1];
13598  __pyx_t_48.data = __pyx_v_nodeArray_.data;
13599  __pyx_t_48.memview = __pyx_v_nodeArray_.memview;
13600  __PYX_INC_MEMVIEW(&__pyx_t_48, 0);
13601  {
13602  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_51 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_52 * __pyx_v_elementNodesArray.strides[1]) )));
13603  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray_.shape[0];
13604  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray_.strides[0];
13605  if (__pyx_tmp_idx < 0)
13606  __pyx_tmp_idx += __pyx_tmp_shape;
13607  if ((0)) __PYX_ERR(0, 892, __pyx_L1_error)
13608  __pyx_t_48.data += __pyx_tmp_idx * __pyx_tmp_stride;
13609 }
13610 
13611 __pyx_t_48.shape[0] = __pyx_v_nodeArray_.shape[1];
13612 __pyx_t_48.strides[0] = __pyx_v_nodeArray_.strides[1];
13613  __pyx_t_48.suboffsets[0] = -1;
13614 
13615 __PYX_XDEC_MEMVIEW(&__pyx_v_nC, 1);
13616  __pyx_v_nC = __pyx_t_48;
13617  __pyx_t_48.memview = NULL;
13618  __pyx_t_48.data = NULL;
13619 
13620  /* "mprans/MeshSmoothing.pyx":893
13621  * nB = nodeArray_[elementNodesArray[eN, 1]]
13622  * nC = nodeArray_[elementNodesArray[eN, 2]]
13623  * elementVolumesArray[eN] = cyGetElementVolumeTriangle(nA, nB, nC) # <<<<<<<<<<<<<<
13624  * elementBarycentersArray[eN, 0] = (nA[0]+nB[0]+nC[0])/3.
13625  * elementBarycentersArray[eN, 1] = (nA[1]+nB[1]+nC[1])/3.
13626  */
13627  __pyx_t_53 = __pyx_v_eN;
13628  if (__pyx_t_53 < 0) __pyx_t_53 += __pyx_v_elementVolumesArray.shape[0];
13629  *((double *) ( /* dim=0 */ (__pyx_v_elementVolumesArray.data + __pyx_t_53 * __pyx_v_elementVolumesArray.strides[0]) )) = __pyx_f_6mprans_13MeshSmoothing_cyGetElementVolumeTriangle(__pyx_v_nA, __pyx_v_nB, __pyx_v_nC);
13630 
13631  /* "mprans/MeshSmoothing.pyx":894
13632  * nC = nodeArray_[elementNodesArray[eN, 2]]
13633  * elementVolumesArray[eN] = cyGetElementVolumeTriangle(nA, nB, nC)
13634  * elementBarycentersArray[eN, 0] = (nA[0]+nB[0]+nC[0])/3. # <<<<<<<<<<<<<<
13635  * elementBarycentersArray[eN, 1] = (nA[1]+nB[1]+nC[1])/3.
13636  * elementBarycentersArray[eN, 2] = (nA[2]+nB[2]+nC[2])/3.
13637  */
13638  __pyx_t_54 = 0;
13639  if (__pyx_t_54 < 0) __pyx_t_54 += __pyx_v_nA.shape[0];
13640  __pyx_t_55 = 0;
13641  if (__pyx_t_55 < 0) __pyx_t_55 += __pyx_v_nB.shape[0];
13642  __pyx_t_56 = 0;
13643  if (__pyx_t_56 < 0) __pyx_t_56 += __pyx_v_nC.shape[0];
13644  __pyx_t_57 = __pyx_v_eN;
13645  __pyx_t_58 = 0;
13646  if (__pyx_t_57 < 0) __pyx_t_57 += __pyx_v_elementBarycentersArray.shape[0];
13647  if (__pyx_t_58 < 0) __pyx_t_58 += __pyx_v_elementBarycentersArray.shape[1];
13648  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray.data + __pyx_t_57 * __pyx_v_elementBarycentersArray.strides[0]) ) + __pyx_t_58 * __pyx_v_elementBarycentersArray.strides[1]) )) = ((((*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_54 * __pyx_v_nA.strides[0]) ))) + (*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_55 * __pyx_v_nB.strides[0]) )))) + (*((double *) ( /* dim=0 */ (__pyx_v_nC.data + __pyx_t_56 * __pyx_v_nC.strides[0]) )))) / 3.);
13649 
13650  /* "mprans/MeshSmoothing.pyx":895
13651  * elementVolumesArray[eN] = cyGetElementVolumeTriangle(nA, nB, nC)
13652  * elementBarycentersArray[eN, 0] = (nA[0]+nB[0]+nC[0])/3.
13653  * elementBarycentersArray[eN, 1] = (nA[1]+nB[1]+nC[1])/3. # <<<<<<<<<<<<<<
13654  * elementBarycentersArray[eN, 2] = (nA[2]+nB[2]+nC[2])/3.
13655  *
13656  */
13657  __pyx_t_59 = 1;
13658  if (__pyx_t_59 < 0) __pyx_t_59 += __pyx_v_nA.shape[0];
13659  __pyx_t_60 = 1;
13660  if (__pyx_t_60 < 0) __pyx_t_60 += __pyx_v_nB.shape[0];
13661  __pyx_t_61 = 1;
13662  if (__pyx_t_61 < 0) __pyx_t_61 += __pyx_v_nC.shape[0];
13663  __pyx_t_62 = __pyx_v_eN;
13664  __pyx_t_63 = 1;
13665  if (__pyx_t_62 < 0) __pyx_t_62 += __pyx_v_elementBarycentersArray.shape[0];
13666  if (__pyx_t_63 < 0) __pyx_t_63 += __pyx_v_elementBarycentersArray.shape[1];
13667  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray.data + __pyx_t_62 * __pyx_v_elementBarycentersArray.strides[0]) ) + __pyx_t_63 * __pyx_v_elementBarycentersArray.strides[1]) )) = ((((*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_59 * __pyx_v_nA.strides[0]) ))) + (*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_60 * __pyx_v_nB.strides[0]) )))) + (*((double *) ( /* dim=0 */ (__pyx_v_nC.data + __pyx_t_61 * __pyx_v_nC.strides[0]) )))) / 3.);
13668 
13669  /* "mprans/MeshSmoothing.pyx":896
13670  * elementBarycentersArray[eN, 0] = (nA[0]+nB[0]+nC[0])/3.
13671  * elementBarycentersArray[eN, 1] = (nA[1]+nB[1]+nC[1])/3.
13672  * elementBarycentersArray[eN, 2] = (nA[2]+nB[2]+nC[2])/3. # <<<<<<<<<<<<<<
13673  *
13674  * # cdef tuple cyGetDistortionDilation(double[:,:,:,:] J_array,
13675  */
13676  __pyx_t_64 = 2;
13677  if (__pyx_t_64 < 0) __pyx_t_64 += __pyx_v_nA.shape[0];
13678  __pyx_t_65 = 2;
13679  if (__pyx_t_65 < 0) __pyx_t_65 += __pyx_v_nB.shape[0];
13680  __pyx_t_66 = 2;
13681  if (__pyx_t_66 < 0) __pyx_t_66 += __pyx_v_nC.shape[0];
13682  __pyx_t_67 = __pyx_v_eN;
13683  __pyx_t_68 = 2;
13684  if (__pyx_t_67 < 0) __pyx_t_67 += __pyx_v_elementBarycentersArray.shape[0];
13685  if (__pyx_t_68 < 0) __pyx_t_68 += __pyx_v_elementBarycentersArray.shape[1];
13686  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray.data + __pyx_t_67 * __pyx_v_elementBarycentersArray.strides[0]) ) + __pyx_t_68 * __pyx_v_elementBarycentersArray.strides[1]) )) = ((((*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_64 * __pyx_v_nA.strides[0]) ))) + (*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_65 * __pyx_v_nB.strides[0]) )))) + (*((double *) ( /* dim=0 */ (__pyx_v_nC.data + __pyx_t_66 * __pyx_v_nC.strides[0]) )))) / 3.);
13687  }
13688 
13689  /* "mprans/MeshSmoothing.pyx":886
13690  * nodeArray_[node, 1] = sum_star[1]/areas
13691  * nodeArray_[node, 2] = sum_star[2]/areas
13692  * if not simultaneous: # <<<<<<<<<<<<<<
13693  * for eOffset in range(nodeElementOffsets[node],
13694  * nodeElementOffsets[node+1]):
13695  */
13696  }
13697 
13698  /* "mprans/MeshSmoothing.pyx":870
13699  * sum_star[2] = 0.
13700  * areas = 0.
13701  * if nodeMaterialTypes[node] == 0: # <<<<<<<<<<<<<<
13702  * for eOffset in range(nodeElementOffsets[node],
13703  * nodeElementOffsets[node+1]):
13704  */
13705  }
13706  }
13707 
13708  /* "mprans/MeshSmoothing.pyx":834
13709  * # nodeArray_[node, 2] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[2]/nNodes
13710  *
13711  * cdef void cySmoothNodesCentroid(double[:,:] nodeArray_, # <<<<<<<<<<<<<<
13712  * int[:] nodeElementOffsets,
13713  * int[:] nodeElementsArray,
13714  */
13715 
13716  /* function exit code */
13717  goto __pyx_L0;
13718  __pyx_L1_error:;
13719  __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
13720  __PYX_XDEC_MEMVIEW(&__pyx_t_48, 1);
13721  __Pyx_WriteUnraisable("mprans.MeshSmoothing.cySmoothNodesCentroid", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
13722  __pyx_L0:;
13723  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray0, 1);
13724  __PYX_XDEC_MEMVIEW(&__pyx_v_nA, 1);
13725  __PYX_XDEC_MEMVIEW(&__pyx_v_nB, 1);
13726  __PYX_XDEC_MEMVIEW(&__pyx_v_nC, 1);
13727  __Pyx_RefNannyFinishContext();
13728 }
13729 
13730 /* "mprans/MeshSmoothing.pyx":932
13731  * # return distortion_array, dilation_array
13732  *
13733  * cdef void cyUpdateDilationElements(double[:] elementDilationArray_, # <<<<<<<<<<<<<<
13734  * double[:] elementVolumeArray,
13735  * double[:] elementVolumeTargetArray,
13736  */
13737 
13738 static void __pyx_f_6mprans_13MeshSmoothing_cyUpdateDilationElements(__Pyx_memviewslice __pyx_v_elementDilationArray_, __Pyx_memviewslice __pyx_v_elementVolumeArray, __Pyx_memviewslice __pyx_v_elementVolumeTargetArray, int __pyx_v_nElements) {
13739  double __pyx_v_dilation;
13740  int __pyx_v_eN;
13741  __Pyx_RefNannyDeclarations
13742  int __pyx_t_1;
13743  int __pyx_t_2;
13744  int __pyx_t_3;
13745  Py_ssize_t __pyx_t_4;
13746  Py_ssize_t __pyx_t_5;
13747  int __pyx_t_6;
13748  Py_ssize_t __pyx_t_7;
13749  __Pyx_RefNannySetupContext("cyUpdateDilationElements", 0);
13750 
13751  /* "mprans/MeshSmoothing.pyx":938
13752  * cdef double dilation
13753  * cdef int eN
13754  * for eN in range(nElements): # <<<<<<<<<<<<<<
13755  * dilation = elementVolumeArray[eN]/elementVolumeTargetArray[eN]
13756  * if dilation < 1.:
13757  */
13758  __pyx_t_1 = __pyx_v_nElements;
13759  __pyx_t_2 = __pyx_t_1;
13760  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
13761  __pyx_v_eN = __pyx_t_3;
13762 
13763  /* "mprans/MeshSmoothing.pyx":939
13764  * cdef int eN
13765  * for eN in range(nElements):
13766  * dilation = elementVolumeArray[eN]/elementVolumeTargetArray[eN] # <<<<<<<<<<<<<<
13767  * if dilation < 1.:
13768  * dilation = 1/dilation
13769  */
13770  __pyx_t_4 = __pyx_v_eN;
13771  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_elementVolumeArray.shape[0];
13772  __pyx_t_5 = __pyx_v_eN;
13773  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementVolumeTargetArray.shape[0];
13774  __pyx_v_dilation = ((*((double *) ( /* dim=0 */ (__pyx_v_elementVolumeArray.data + __pyx_t_4 * __pyx_v_elementVolumeArray.strides[0]) ))) / (*((double *) ( /* dim=0 */ (__pyx_v_elementVolumeTargetArray.data + __pyx_t_5 * __pyx_v_elementVolumeTargetArray.strides[0]) ))));
13775 
13776  /* "mprans/MeshSmoothing.pyx":940
13777  * for eN in range(nElements):
13778  * dilation = elementVolumeArray[eN]/elementVolumeTargetArray[eN]
13779  * if dilation < 1.: # <<<<<<<<<<<<<<
13780  * dilation = 1/dilation
13781  * elementDilationArray_[eN] = dilation
13782  */
13783  __pyx_t_6 = ((__pyx_v_dilation < 1.) != 0);
13784  if (__pyx_t_6) {
13785 
13786  /* "mprans/MeshSmoothing.pyx":941
13787  * dilation = elementVolumeArray[eN]/elementVolumeTargetArray[eN]
13788  * if dilation < 1.:
13789  * dilation = 1/dilation # <<<<<<<<<<<<<<
13790  * elementDilationArray_[eN] = dilation
13791  *
13792  */
13793  __pyx_v_dilation = (1.0 / __pyx_v_dilation);
13794 
13795  /* "mprans/MeshSmoothing.pyx":940
13796  * for eN in range(nElements):
13797  * dilation = elementVolumeArray[eN]/elementVolumeTargetArray[eN]
13798  * if dilation < 1.: # <<<<<<<<<<<<<<
13799  * dilation = 1/dilation
13800  * elementDilationArray_[eN] = dilation
13801  */
13802  }
13803 
13804  /* "mprans/MeshSmoothing.pyx":942
13805  * if dilation < 1.:
13806  * dilation = 1/dilation
13807  * elementDilationArray_[eN] = dilation # <<<<<<<<<<<<<<
13808  *
13809  * cdef void cyUpdateDistortionElements(double[:] elementDistortionArray_,
13810  */
13811  __pyx_t_7 = __pyx_v_eN;
13812  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_elementDilationArray_.shape[0];
13813  *((double *) ( /* dim=0 */ (__pyx_v_elementDilationArray_.data + __pyx_t_7 * __pyx_v_elementDilationArray_.strides[0]) )) = __pyx_v_dilation;
13814  }
13815 
13816  /* "mprans/MeshSmoothing.pyx":932
13817  * # return distortion_array, dilation_array
13818  *
13819  * cdef void cyUpdateDilationElements(double[:] elementDilationArray_, # <<<<<<<<<<<<<<
13820  * double[:] elementVolumeArray,
13821  * double[:] elementVolumeTargetArray,
13822  */
13823 
13824  /* function exit code */
13825  __Pyx_RefNannyFinishContext();
13826 }
13827 
13828 /* "mprans/MeshSmoothing.pyx":944
13829  * elementDilationArray_[eN] = dilation
13830  *
13831  * cdef void cyUpdateDistortionElements(double[:] elementDistortionArray_, # <<<<<<<<<<<<<<
13832  * double[:,:,:,:] J_array,
13833  * double[:,:] detJ_array,
13834  */
13835 
13836 static void __pyx_f_6mprans_13MeshSmoothing_cyUpdateDistortionElements(__Pyx_memviewslice __pyx_v_elementDistortionArray_, __Pyx_memviewslice __pyx_v_J_array, __Pyx_memviewslice __pyx_v_detJ_array, int __pyx_v_nd, int __pyx_v_nElements) {
13837  __Pyx_memviewslice __pyx_v_J = { 0, 0, { 0 }, { 0 }, { 0 } };
13838  __Pyx_memviewslice __pyx_v_JT = { 0, 0, { 0 }, { 0 }, { 0 } };
13839  double __pyx_v_detJ;
13840  double __pyx_v_trJTJ;
13841  __Pyx_memviewslice __pyx_v_JTJ = { 0, 0, { 0 }, { 0 }, { 0 } };
13842  int __pyx_v_eN;
13843  int __pyx_v_iJ;
13844  __Pyx_RefNannyDeclarations
13845  PyObject *__pyx_t_1 = NULL;
13846  Py_ssize_t __pyx_t_2;
13847  Py_ssize_t __pyx_t_3;
13848  int __pyx_t_4;
13849  Py_ssize_t __pyx_t_5;
13850  Py_ssize_t __pyx_t_6;
13851  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
13852  PyObject *__pyx_t_8 = NULL;
13853  PyObject *__pyx_t_9 = NULL;
13854  PyObject *__pyx_t_10 = NULL;
13855  PyObject *__pyx_t_11 = NULL;
13856  int __pyx_t_12;
13857  PyObject *__pyx_t_13 = NULL;
13858  size_t __pyx_t_14;
13859  Py_ssize_t __pyx_t_15;
13860  Py_ssize_t __pyx_t_16;
13861  Py_ssize_t __pyx_t_17;
13862  Py_ssize_t __pyx_t_18;
13863  __Pyx_RefNannySetupContext("cyUpdateDistortionElements", 0);
13864 
13865  /* "mprans/MeshSmoothing.pyx":956
13866  * cdef int eN
13867  * cdef int iJ
13868  * for eN in range(len(nElements)): # <<<<<<<<<<<<<<
13869  * detJ = detJ_array[eN, 0] # index 0 as it is the same for all quadrature points
13870  * J = J_array[eN][0]
13871  */
13872  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_nElements); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 956, __pyx_L1_error)
13873  __Pyx_GOTREF(__pyx_t_1);
13874  __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 956, __pyx_L1_error)
13875  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13876  __pyx_t_3 = __pyx_t_2;
13877  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
13878  __pyx_v_eN = __pyx_t_4;
13879 
13880  /* "mprans/MeshSmoothing.pyx":957
13881  * cdef int iJ
13882  * for eN in range(len(nElements)):
13883  * detJ = detJ_array[eN, 0] # index 0 as it is the same for all quadrature points # <<<<<<<<<<<<<<
13884  * J = J_array[eN][0]
13885  * JT = np.transpose(J)
13886  */
13887  __pyx_t_5 = __pyx_v_eN;
13888  __pyx_t_6 = 0;
13889  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_detJ_array.shape[0];
13890  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_detJ_array.shape[1];
13891  __pyx_v_detJ = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_detJ_array.data + __pyx_t_5 * __pyx_v_detJ_array.strides[0]) ) + __pyx_t_6 * __pyx_v_detJ_array.strides[1]) )));
13892 
13893  /* "mprans/MeshSmoothing.pyx":958
13894  * for eN in range(len(nElements)):
13895  * detJ = detJ_array[eN, 0] # index 0 as it is the same for all quadrature points
13896  * J = J_array[eN][0] # <<<<<<<<<<<<<<
13897  * JT = np.transpose(J)
13898  * JTJ = np.zeros_like(J)
13899  */
13900  __pyx_t_7.data = __pyx_v_J_array.data;
13901  __pyx_t_7.memview = __pyx_v_J_array.memview;
13902  __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
13903  {
13904  Py_ssize_t __pyx_tmp_idx = __pyx_v_eN;
13905  Py_ssize_t __pyx_tmp_shape = __pyx_v_J_array.shape[0];
13906  Py_ssize_t __pyx_tmp_stride = __pyx_v_J_array.strides[0];
13907  if (__pyx_tmp_idx < 0)
13908  __pyx_tmp_idx += __pyx_tmp_shape;
13909  if ((0)) __PYX_ERR(0, 958, __pyx_L1_error)
13910  __pyx_t_7.data += __pyx_tmp_idx * __pyx_tmp_stride;
13911 }
13912 
13913 {
13914  Py_ssize_t __pyx_tmp_idx = 0;
13915  Py_ssize_t __pyx_tmp_shape = __pyx_v_J_array.shape[1];
13916  Py_ssize_t __pyx_tmp_stride = __pyx_v_J_array.strides[1];
13917  if (__pyx_tmp_idx < 0)
13918  __pyx_tmp_idx += __pyx_tmp_shape;
13919  if ((0)) __PYX_ERR(0, 958, __pyx_L1_error)
13920  __pyx_t_7.data += __pyx_tmp_idx * __pyx_tmp_stride;
13921 }
13922 
13923 __pyx_t_7.shape[0] = __pyx_v_J_array.shape[2];
13924 __pyx_t_7.strides[0] = __pyx_v_J_array.strides[2];
13925  __pyx_t_7.suboffsets[0] = -1;
13926 
13927 __pyx_t_7.shape[1] = __pyx_v_J_array.shape[3];
13928 __pyx_t_7.strides[1] = __pyx_v_J_array.strides[3];
13929  __pyx_t_7.suboffsets[1] = -1;
13930 
13931 __PYX_XDEC_MEMVIEW(&__pyx_v_J, 1);
13932  __pyx_v_J = __pyx_t_7;
13933  __pyx_t_7.memview = NULL;
13934  __pyx_t_7.data = NULL;
13935 
13936  /* "mprans/MeshSmoothing.pyx":959
13937  * detJ = detJ_array[eN, 0] # index 0 as it is the same for all quadrature points
13938  * J = J_array[eN][0]
13939  * JT = np.transpose(J) # <<<<<<<<<<<<<<
13940  * JTJ = np.zeros_like(J)
13941  * JTJ = np.dot(J, JT)
13942  */
13943  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 959, __pyx_L1_error)
13944  __Pyx_GOTREF(__pyx_t_8);
13945  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_transpose); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 959, __pyx_L1_error)
13946  __Pyx_GOTREF(__pyx_t_9);
13947  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
13948  __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v_J, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 959, __pyx_L1_error)
13949  __Pyx_GOTREF(__pyx_t_8);
13950  __pyx_t_10 = NULL;
13951  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
13952  __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
13953  if (likely(__pyx_t_10)) {
13954  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
13955  __Pyx_INCREF(__pyx_t_10);
13956  __Pyx_INCREF(function);
13957  __Pyx_DECREF_SET(__pyx_t_9, function);
13958  }
13959  }
13960  __pyx_t_1 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_10, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_8);
13961  __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
13962  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
13963  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 959, __pyx_L1_error)
13964  __Pyx_GOTREF(__pyx_t_1);
13965  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13966  __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 959, __pyx_L1_error)
13967  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13968  __PYX_XDEC_MEMVIEW(&__pyx_v_JT, 1);
13969  __pyx_v_JT = __pyx_t_7;
13970  __pyx_t_7.memview = NULL;
13971  __pyx_t_7.data = NULL;
13972 
13973  /* "mprans/MeshSmoothing.pyx":960
13974  * J = J_array[eN][0]
13975  * JT = np.transpose(J)
13976  * JTJ = np.zeros_like(J) # <<<<<<<<<<<<<<
13977  * JTJ = np.dot(J, JT)
13978  * trJTJ = 0.
13979  */
13980  __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 960, __pyx_L1_error)
13981  __Pyx_GOTREF(__pyx_t_9);
13982  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros_like); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 960, __pyx_L1_error)
13983  __Pyx_GOTREF(__pyx_t_8);
13984  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13985  __pyx_t_9 = __pyx_memoryview_fromslice(__pyx_v_J, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 960, __pyx_L1_error)
13986  __Pyx_GOTREF(__pyx_t_9);
13987  __pyx_t_10 = NULL;
13988  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
13989  __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8);
13990  if (likely(__pyx_t_10)) {
13991  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
13992  __Pyx_INCREF(__pyx_t_10);
13993  __Pyx_INCREF(function);
13994  __Pyx_DECREF_SET(__pyx_t_8, function);
13995  }
13996  }
13997  __pyx_t_1 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_10, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9);
13998  __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
13999  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14000  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 960, __pyx_L1_error)
14001  __Pyx_GOTREF(__pyx_t_1);
14002  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
14003  __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 960, __pyx_L1_error)
14004  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14005  __PYX_XDEC_MEMVIEW(&__pyx_v_JTJ, 1);
14006  __pyx_v_JTJ = __pyx_t_7;
14007  __pyx_t_7.memview = NULL;
14008  __pyx_t_7.data = NULL;
14009 
14010  /* "mprans/MeshSmoothing.pyx":961
14011  * JT = np.transpose(J)
14012  * JTJ = np.zeros_like(J)
14013  * JTJ = np.dot(J, JT) # <<<<<<<<<<<<<<
14014  * trJTJ = 0.
14015  * for iJ in range(len(J)):
14016  */
14017  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 961, __pyx_L1_error)
14018  __Pyx_GOTREF(__pyx_t_8);
14019  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_dot); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 961, __pyx_L1_error)
14020  __Pyx_GOTREF(__pyx_t_9);
14021  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
14022  __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v_J, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 961, __pyx_L1_error)
14023  __Pyx_GOTREF(__pyx_t_8);
14024  __pyx_t_10 = __pyx_memoryview_fromslice(__pyx_v_JT, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 961, __pyx_L1_error)
14025  __Pyx_GOTREF(__pyx_t_10);
14026  __pyx_t_11 = NULL;
14027  __pyx_t_12 = 0;
14028  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
14029  __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_9);
14030  if (likely(__pyx_t_11)) {
14031  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
14032  __Pyx_INCREF(__pyx_t_11);
14033  __Pyx_INCREF(function);
14034  __Pyx_DECREF_SET(__pyx_t_9, function);
14035  __pyx_t_12 = 1;
14036  }
14037  }
14038  #if CYTHON_FAST_PYCALL
14039  if (PyFunction_Check(__pyx_t_9)) {
14040  PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_8, __pyx_t_10};
14041  __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 961, __pyx_L1_error)
14042  __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
14043  __Pyx_GOTREF(__pyx_t_1);
14044  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
14045  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
14046  } else
14047  #endif
14048  #if CYTHON_FAST_PYCCALL
14049  if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
14050  PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_8, __pyx_t_10};
14051  __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 961, __pyx_L1_error)
14052  __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
14053  __Pyx_GOTREF(__pyx_t_1);
14054  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
14055  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
14056  } else
14057  #endif
14058  {
14059  __pyx_t_13 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 961, __pyx_L1_error)
14060  __Pyx_GOTREF(__pyx_t_13);
14061  if (__pyx_t_11) {
14062  __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11); __pyx_t_11 = NULL;
14063  }
14064  __Pyx_GIVEREF(__pyx_t_8);
14065  PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_12, __pyx_t_8);
14066  __Pyx_GIVEREF(__pyx_t_10);
14067  PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_12, __pyx_t_10);
14068  __pyx_t_8 = 0;
14069  __pyx_t_10 = 0;
14070  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 961, __pyx_L1_error)
14071  __Pyx_GOTREF(__pyx_t_1);
14072  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
14073  }
14074  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14075  __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 961, __pyx_L1_error)
14076  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14077  __PYX_XDEC_MEMVIEW(&__pyx_v_JTJ, 1);
14078  __pyx_v_JTJ = __pyx_t_7;
14079  __pyx_t_7.memview = NULL;
14080  __pyx_t_7.data = NULL;
14081 
14082  /* "mprans/MeshSmoothing.pyx":962
14083  * JTJ = np.zeros_like(J)
14084  * JTJ = np.dot(J, JT)
14085  * trJTJ = 0. # <<<<<<<<<<<<<<
14086  * for iJ in range(len(J)):
14087  * trJTJ += JTJ[iJ,iJ]
14088  */
14089  __pyx_v_trJTJ = 0.;
14090 
14091  /* "mprans/MeshSmoothing.pyx":963
14092  * JTJ = np.dot(J, JT)
14093  * trJTJ = 0.
14094  * for iJ in range(len(J)): # <<<<<<<<<<<<<<
14095  * trJTJ += JTJ[iJ,iJ]
14096  * elementDistortionArray_[eN] = (1./nd*trJTJ)**(nd/2.)/detJ
14097  */
14098  __pyx_t_14 = __Pyx_MemoryView_Len(__pyx_v_J);
14099  __pyx_t_15 = __pyx_t_14;
14100  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_15; __pyx_t_12+=1) {
14101  __pyx_v_iJ = __pyx_t_12;
14102 
14103  /* "mprans/MeshSmoothing.pyx":964
14104  * trJTJ = 0.
14105  * for iJ in range(len(J)):
14106  * trJTJ += JTJ[iJ,iJ] # <<<<<<<<<<<<<<
14107  * elementDistortionArray_[eN] = (1./nd*trJTJ)**(nd/2.)/detJ
14108  *
14109  */
14110  __pyx_t_16 = __pyx_v_iJ;
14111  __pyx_t_17 = __pyx_v_iJ;
14112  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_JTJ.shape[0];
14113  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_JTJ.shape[1];
14114  __pyx_v_trJTJ = (__pyx_v_trJTJ + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_JTJ.data + __pyx_t_16 * __pyx_v_JTJ.strides[0]) ) + __pyx_t_17 * __pyx_v_JTJ.strides[1]) ))));
14115  }
14116 
14117  /* "mprans/MeshSmoothing.pyx":965
14118  * for iJ in range(len(J)):
14119  * trJTJ += JTJ[iJ,iJ]
14120  * elementDistortionArray_[eN] = (1./nd*trJTJ)**(nd/2.)/detJ # <<<<<<<<<<<<<<
14121  *
14122  * cdef void cyUpdateInverseMeanRatioTriangleNodes(double[:] IMRNodesArray_,
14123  */
14124  __pyx_t_18 = __pyx_v_eN;
14125  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_elementDistortionArray_.shape[0];
14126  *((double *) ( /* dim=0 */ (__pyx_v_elementDistortionArray_.data + __pyx_t_18 * __pyx_v_elementDistortionArray_.strides[0]) )) = (pow(((1. / __pyx_v_nd) * __pyx_v_trJTJ), (__pyx_v_nd / 2.)) / __pyx_v_detJ);
14127  }
14128 
14129  /* "mprans/MeshSmoothing.pyx":944
14130  * elementDilationArray_[eN] = dilation
14131  *
14132  * cdef void cyUpdateDistortionElements(double[:] elementDistortionArray_, # <<<<<<<<<<<<<<
14133  * double[:,:,:,:] J_array,
14134  * double[:,:] detJ_array,
14135  */
14136 
14137  /* function exit code */
14138  goto __pyx_L0;
14139  __pyx_L1_error:;
14140  __Pyx_XDECREF(__pyx_t_1);
14141  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
14142  __Pyx_XDECREF(__pyx_t_8);
14143  __Pyx_XDECREF(__pyx_t_9);
14144  __Pyx_XDECREF(__pyx_t_10);
14145  __Pyx_XDECREF(__pyx_t_11);
14146  __Pyx_XDECREF(__pyx_t_13);
14147  __Pyx_WriteUnraisable("mprans.MeshSmoothing.cyUpdateDistortionElements", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
14148  __pyx_L0:;
14149  __PYX_XDEC_MEMVIEW(&__pyx_v_J, 1);
14150  __PYX_XDEC_MEMVIEW(&__pyx_v_JT, 1);
14151  __PYX_XDEC_MEMVIEW(&__pyx_v_JTJ, 1);
14152  __Pyx_RefNannyFinishContext();
14153 }
14154 
14155 /* "mprans/MeshSmoothing.pyx":967
14156  * elementDistortionArray_[eN] = (1./nd*trJTJ)**(nd/2.)/detJ
14157  *
14158  * cdef void cyUpdateInverseMeanRatioTriangleNodes(double[:] IMRNodesArray_, # <<<<<<<<<<<<<<
14159  * double[:,:] nodeArray,
14160  * int[:,:] elementNodesArray,
14161  */
14162 
14163 static void __pyx_f_6mprans_13MeshSmoothing_cyUpdateInverseMeanRatioTriangleNodes(__Pyx_memviewslice __pyx_v_IMRNodesArray_, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementNodesArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_nodeElementsArray, int __pyx_v_nElements, int __pyx_v_nNodes, struct __pyx_opt_args_6mprans_13MeshSmoothing_cyUpdateInverseMeanRatioTriangleNodes *__pyx_optional_args) {
14164 
14165  /* "mprans/MeshSmoothing.pyx":974
14166  * int nElements,
14167  * int nNodes,
14168  * bool el_average=False): # <<<<<<<<<<<<<<
14169  * cdef double[:,:] W = np.array([[1., 0.5],
14170  * [0., sqrt(3)/2.]])
14171  */
14172  bool __pyx_v_el_average = ((bool)0);
14173  __Pyx_memviewslice __pyx_v_W = { 0, 0, { 0 }, { 0 }, { 0 } };
14174  __Pyx_memviewslice __pyx_v_A = { 0, 0, { 0 }, { 0 }, { 0 } };
14175  __Pyx_memviewslice __pyx_v_AW = { 0, 0, { 0 }, { 0 }, { 0 } };
14176  __Pyx_memviewslice __pyx_v_nElementsArray = { 0, 0, { 0 }, { 0 }, { 0 } };
14177  __Pyx_memviewslice __pyx_v_IMR_elements = { 0, 0, { 0 }, { 0 }, { 0 } };
14178  int __pyx_v_nNel;
14179  __Pyx_memviewslice __pyx_v_vec_a = { 0, 0, { 0 }, { 0 }, { 0 } };
14180  __Pyx_memviewslice __pyx_v_vec_b = { 0, 0, { 0 }, { 0 }, { 0 } };
14181  __Pyx_memviewslice __pyx_v_vec_c = { 0, 0, { 0 }, { 0 }, { 0 } };
14182  double __pyx_v_IMR;
14183  int __pyx_v_nEl;
14184  int __pyx_v_iN;
14185  int __pyx_v_eN;
14186  int __pyx_v_node;
14187  int __pyx_v_eOffset;
14188  __Pyx_RefNannyDeclarations
14189  PyObject *__pyx_t_1 = NULL;
14190  PyObject *__pyx_t_2 = NULL;
14191  PyObject *__pyx_t_3 = NULL;
14192  PyObject *__pyx_t_4 = NULL;
14193  PyObject *__pyx_t_5 = NULL;
14194  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
14195  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
14196  int __pyx_t_8;
14197  __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } };
14198  int __pyx_t_10;
14199  int __pyx_t_11;
14200  int __pyx_t_12;
14201  int __pyx_t_13;
14202  int __pyx_t_14;
14203  int __pyx_t_15;
14204  Py_ssize_t __pyx_t_16;
14205  Py_ssize_t __pyx_t_17;
14206  Py_ssize_t __pyx_t_18;
14207  Py_ssize_t __pyx_t_19;
14208  Py_ssize_t __pyx_t_20;
14209  Py_ssize_t __pyx_t_21;
14210  Py_ssize_t __pyx_t_22;
14211  Py_ssize_t __pyx_t_23;
14212  Py_ssize_t __pyx_t_24;
14213  Py_ssize_t __pyx_t_25;
14214  Py_ssize_t __pyx_t_26;
14215  Py_ssize_t __pyx_t_27;
14216  Py_ssize_t __pyx_t_28;
14217  Py_ssize_t __pyx_t_29;
14218  Py_ssize_t __pyx_t_30;
14219  Py_ssize_t __pyx_t_31;
14220  Py_ssize_t __pyx_t_32;
14221  Py_ssize_t __pyx_t_33;
14222  Py_ssize_t __pyx_t_34;
14223  Py_ssize_t __pyx_t_35;
14224  Py_ssize_t __pyx_t_36;
14225  Py_ssize_t __pyx_t_37;
14226  Py_ssize_t __pyx_t_38;
14227  Py_ssize_t __pyx_t_39;
14228  PyObject *__pyx_t_40 = NULL;
14229  PyObject *__pyx_t_41 = NULL;
14230  int __pyx_t_42;
14231  Py_ssize_t __pyx_t_43;
14232  Py_ssize_t __pyx_t_44;
14233  Py_ssize_t __pyx_t_45;
14234  Py_ssize_t __pyx_t_46;
14235  Py_ssize_t __pyx_t_47;
14236  Py_ssize_t __pyx_t_48;
14237  Py_ssize_t __pyx_t_49;
14238  Py_ssize_t __pyx_t_50;
14239  Py_ssize_t __pyx_t_51;
14240  Py_ssize_t __pyx_t_52;
14241  Py_ssize_t __pyx_t_53;
14242  Py_ssize_t __pyx_t_54;
14243  Py_ssize_t __pyx_t_55;
14244  Py_ssize_t __pyx_t_56;
14245  Py_ssize_t __pyx_t_57;
14246  Py_ssize_t __pyx_t_58;
14247  Py_ssize_t __pyx_t_59;
14248  Py_ssize_t __pyx_t_60;
14249  Py_ssize_t __pyx_t_61;
14250  Py_ssize_t __pyx_t_62;
14251  Py_ssize_t __pyx_t_63;
14252  Py_ssize_t __pyx_t_64;
14253  Py_ssize_t __pyx_t_65;
14254  Py_ssize_t __pyx_t_66;
14255  Py_ssize_t __pyx_t_67;
14256  Py_ssize_t __pyx_t_68;
14257  Py_ssize_t __pyx_t_69;
14258  Py_ssize_t __pyx_t_70;
14259  Py_ssize_t __pyx_t_71;
14260  Py_ssize_t __pyx_t_72;
14261  Py_ssize_t __pyx_t_73;
14262  Py_ssize_t __pyx_t_74;
14263  __Pyx_RefNannySetupContext("cyUpdateInverseMeanRatioTriangleNodes", 0);
14264  if (__pyx_optional_args) {
14265  if (__pyx_optional_args->__pyx_n > 0) {
14266  __pyx_v_el_average = __pyx_optional_args->el_average;
14267  }
14268  }
14269 
14270  /* "mprans/MeshSmoothing.pyx":975
14271  * int nNodes,
14272  * bool el_average=False):
14273  * cdef double[:,:] W = np.array([[1., 0.5], # <<<<<<<<<<<<<<
14274  * [0., sqrt(3)/2.]])
14275  * cdef double[:,:] A = np.zeros((2,2))
14276  */
14277  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 975, __pyx_L1_error)
14278  __Pyx_GOTREF(__pyx_t_2);
14279  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 975, __pyx_L1_error)
14280  __Pyx_GOTREF(__pyx_t_3);
14281  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14282  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 975, __pyx_L1_error)
14283  __Pyx_GOTREF(__pyx_t_2);
14284  __Pyx_INCREF(__pyx_float_1_);
14285  __Pyx_GIVEREF(__pyx_float_1_);
14286  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_float_1_);
14287  __Pyx_INCREF(__pyx_float_0_5);
14288  __Pyx_GIVEREF(__pyx_float_0_5);
14289  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_float_0_5);
14290 
14291  /* "mprans/MeshSmoothing.pyx":976
14292  * bool el_average=False):
14293  * cdef double[:,:] W = np.array([[1., 0.5],
14294  * [0., sqrt(3)/2.]]) # <<<<<<<<<<<<<<
14295  * cdef double[:,:] A = np.zeros((2,2))
14296  * cdef double[:,:] AW = np.zeros((2,2))
14297  */
14298  __pyx_t_4 = PyFloat_FromDouble((sqrt(3.0) / 2.)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 976, __pyx_L1_error)
14299  __Pyx_GOTREF(__pyx_t_4);
14300  __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 976, __pyx_L1_error)
14301  __Pyx_GOTREF(__pyx_t_5);
14302  __Pyx_INCREF(__pyx_float_0_);
14303  __Pyx_GIVEREF(__pyx_float_0_);
14304  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_float_0_);
14305  __Pyx_GIVEREF(__pyx_t_4);
14306  PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
14307  __pyx_t_4 = 0;
14308 
14309  /* "mprans/MeshSmoothing.pyx":975
14310  * int nNodes,
14311  * bool el_average=False):
14312  * cdef double[:,:] W = np.array([[1., 0.5], # <<<<<<<<<<<<<<
14313  * [0., sqrt(3)/2.]])
14314  * cdef double[:,:] A = np.zeros((2,2))
14315  */
14316  __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 975, __pyx_L1_error)
14317  __Pyx_GOTREF(__pyx_t_4);
14318  __Pyx_GIVEREF(__pyx_t_2);
14319  PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
14320  __Pyx_GIVEREF(__pyx_t_5);
14321  PyList_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
14322  __pyx_t_2 = 0;
14323  __pyx_t_5 = 0;
14324  __pyx_t_5 = NULL;
14325  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
14326  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
14327  if (likely(__pyx_t_5)) {
14328  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
14329  __Pyx_INCREF(__pyx_t_5);
14330  __Pyx_INCREF(function);
14331  __Pyx_DECREF_SET(__pyx_t_3, function);
14332  }
14333  }
14334  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
14335  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
14336  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14337  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 975, __pyx_L1_error)
14338  __Pyx_GOTREF(__pyx_t_1);
14339  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14340  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 975, __pyx_L1_error)
14341  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14342  __pyx_v_W = __pyx_t_6;
14343  __pyx_t_6.memview = NULL;
14344  __pyx_t_6.data = NULL;
14345 
14346  /* "mprans/MeshSmoothing.pyx":977
14347  * cdef double[:,:] W = np.array([[1., 0.5],
14348  * [0., sqrt(3)/2.]])
14349  * cdef double[:,:] A = np.zeros((2,2)) # <<<<<<<<<<<<<<
14350  * cdef double[:,:] AW = np.zeros((2,2))
14351  * cdef int[:] nElementsArray = np.zeros(nElements)
14352  */
14353  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 977, __pyx_L1_error)
14354  __Pyx_GOTREF(__pyx_t_3);
14355  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 977, __pyx_L1_error)
14356  __Pyx_GOTREF(__pyx_t_4);
14357  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14358  __pyx_t_3 = NULL;
14359  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
14360  __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
14361  if (likely(__pyx_t_3)) {
14362  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
14363  __Pyx_INCREF(__pyx_t_3);
14364  __Pyx_INCREF(function);
14365  __Pyx_DECREF_SET(__pyx_t_4, function);
14366  }
14367  }
14368  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_tuple__6) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_tuple__6);
14369  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
14370  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 977, __pyx_L1_error)
14371  __Pyx_GOTREF(__pyx_t_1);
14372  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14373  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 977, __pyx_L1_error)
14374  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14375  __pyx_v_A = __pyx_t_6;
14376  __pyx_t_6.memview = NULL;
14377  __pyx_t_6.data = NULL;
14378 
14379  /* "mprans/MeshSmoothing.pyx":978
14380  * [0., sqrt(3)/2.]])
14381  * cdef double[:,:] A = np.zeros((2,2))
14382  * cdef double[:,:] AW = np.zeros((2,2)) # <<<<<<<<<<<<<<
14383  * cdef int[:] nElementsArray = np.zeros(nElements)
14384  * cdef double[:] IMR_elements
14385  */
14386  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 978, __pyx_L1_error)
14387  __Pyx_GOTREF(__pyx_t_4);
14388  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 978, __pyx_L1_error)
14389  __Pyx_GOTREF(__pyx_t_3);
14390  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14391  __pyx_t_4 = NULL;
14392  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
14393  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
14394  if (likely(__pyx_t_4)) {
14395  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
14396  __Pyx_INCREF(__pyx_t_4);
14397  __Pyx_INCREF(function);
14398  __Pyx_DECREF_SET(__pyx_t_3, function);
14399  }
14400  }
14401  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_tuple__6) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_tuple__6);
14402  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
14403  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 978, __pyx_L1_error)
14404  __Pyx_GOTREF(__pyx_t_1);
14405  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14406  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 978, __pyx_L1_error)
14407  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14408  __pyx_v_AW = __pyx_t_6;
14409  __pyx_t_6.memview = NULL;
14410  __pyx_t_6.data = NULL;
14411 
14412  /* "mprans/MeshSmoothing.pyx":979
14413  * cdef double[:,:] A = np.zeros((2,2))
14414  * cdef double[:,:] AW = np.zeros((2,2))
14415  * cdef int[:] nElementsArray = np.zeros(nElements) # <<<<<<<<<<<<<<
14416  * cdef double[:] IMR_elements
14417  * if el_average:
14418  */
14419  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 979, __pyx_L1_error)
14420  __Pyx_GOTREF(__pyx_t_3);
14421  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 979, __pyx_L1_error)
14422  __Pyx_GOTREF(__pyx_t_4);
14423  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14424  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nElements); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 979, __pyx_L1_error)
14425  __Pyx_GOTREF(__pyx_t_3);
14426  __pyx_t_5 = NULL;
14427  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
14428  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
14429  if (likely(__pyx_t_5)) {
14430  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
14431  __Pyx_INCREF(__pyx_t_5);
14432  __Pyx_INCREF(function);
14433  __Pyx_DECREF_SET(__pyx_t_4, function);
14434  }
14435  }
14436  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
14437  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
14438  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14439  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 979, __pyx_L1_error)
14440  __Pyx_GOTREF(__pyx_t_1);
14441  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14442  __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 979, __pyx_L1_error)
14443  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14444  __pyx_v_nElementsArray = __pyx_t_7;
14445  __pyx_t_7.memview = NULL;
14446  __pyx_t_7.data = NULL;
14447 
14448  /* "mprans/MeshSmoothing.pyx":981
14449  * cdef int[:] nElementsArray = np.zeros(nElements)
14450  * cdef double[:] IMR_elements
14451  * if el_average: # <<<<<<<<<<<<<<
14452  * IMR_elements = np.zeros(nNodes)
14453  * cdef int nNel = elementNodesArray.shape[1]
14454  */
14455  __pyx_t_8 = (__pyx_v_el_average != 0);
14456  if (__pyx_t_8) {
14457 
14458  /* "mprans/MeshSmoothing.pyx":982
14459  * cdef double[:] IMR_elements
14460  * if el_average:
14461  * IMR_elements = np.zeros(nNodes) # <<<<<<<<<<<<<<
14462  * cdef int nNel = elementNodesArray.shape[1]
14463  * cdef double[:] vec_a
14464  */
14465  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 982, __pyx_L1_error)
14466  __Pyx_GOTREF(__pyx_t_4);
14467  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 982, __pyx_L1_error)
14468  __Pyx_GOTREF(__pyx_t_3);
14469  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14470  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_nNodes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 982, __pyx_L1_error)
14471  __Pyx_GOTREF(__pyx_t_4);
14472  __pyx_t_5 = NULL;
14473  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
14474  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
14475  if (likely(__pyx_t_5)) {
14476  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
14477  __Pyx_INCREF(__pyx_t_5);
14478  __Pyx_INCREF(function);
14479  __Pyx_DECREF_SET(__pyx_t_3, function);
14480  }
14481  }
14482  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
14483  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
14484  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14485  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 982, __pyx_L1_error)
14486  __Pyx_GOTREF(__pyx_t_1);
14487  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14488  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 982, __pyx_L1_error)
14489  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14490  __pyx_v_IMR_elements = __pyx_t_9;
14491  __pyx_t_9.memview = NULL;
14492  __pyx_t_9.data = NULL;
14493 
14494  /* "mprans/MeshSmoothing.pyx":981
14495  * cdef int[:] nElementsArray = np.zeros(nElements)
14496  * cdef double[:] IMR_elements
14497  * if el_average: # <<<<<<<<<<<<<<
14498  * IMR_elements = np.zeros(nNodes)
14499  * cdef int nNel = elementNodesArray.shape[1]
14500  */
14501  }
14502 
14503  /* "mprans/MeshSmoothing.pyx":983
14504  * if el_average:
14505  * IMR_elements = np.zeros(nNodes)
14506  * cdef int nNel = elementNodesArray.shape[1] # <<<<<<<<<<<<<<
14507  * cdef double[:] vec_a
14508  * cdef double[:] vec_b
14509  */
14510  __pyx_v_nNel = (__pyx_v_elementNodesArray.shape[1]);
14511 
14512  /* "mprans/MeshSmoothing.pyx":988
14513  * cdef double[:] vec_c
14514  * cdef double IMR
14515  * cdef int nEl = 0 # <<<<<<<<<<<<<<
14516  * cdef int iN
14517  * cdef int eN
14518  */
14519  __pyx_v_nEl = 0;
14520 
14521  /* "mprans/MeshSmoothing.pyx":993
14522  * cdef int node
14523  * cdef int eOffset
14524  * for eN in range(nElements): # <<<<<<<<<<<<<<
14525  * for iN in range(nNel):
14526  * node = elementNodesArray[eN, iN]
14527  */
14528  __pyx_t_10 = __pyx_v_nElements;
14529  __pyx_t_11 = __pyx_t_10;
14530  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
14531  __pyx_v_eN = __pyx_t_12;
14532 
14533  /* "mprans/MeshSmoothing.pyx":994
14534  * cdef int eOffset
14535  * for eN in range(nElements):
14536  * for iN in range(nNel): # <<<<<<<<<<<<<<
14537  * node = elementNodesArray[eN, iN]
14538  * vec_a = nodeArray[elementNodesArray[eN, iN]]
14539  */
14540  __pyx_t_13 = __pyx_v_nNel;
14541  __pyx_t_14 = __pyx_t_13;
14542  for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
14543  __pyx_v_iN = __pyx_t_15;
14544 
14545  /* "mprans/MeshSmoothing.pyx":995
14546  * for eN in range(nElements):
14547  * for iN in range(nNel):
14548  * node = elementNodesArray[eN, iN] # <<<<<<<<<<<<<<
14549  * vec_a = nodeArray[elementNodesArray[eN, iN]]
14550  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
14551  */
14552  __pyx_t_16 = __pyx_v_eN;
14553  __pyx_t_17 = __pyx_v_iN;
14554  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_elementNodesArray.shape[0];
14555  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_elementNodesArray.shape[1];
14556  __pyx_v_node = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_16 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_17 * __pyx_v_elementNodesArray.strides[1]) )));
14557 
14558  /* "mprans/MeshSmoothing.pyx":996
14559  * for iN in range(nNel):
14560  * node = elementNodesArray[eN, iN]
14561  * vec_a = nodeArray[elementNodesArray[eN, iN]] # <<<<<<<<<<<<<<
14562  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
14563  * vec_c = nodeArray[elementNodesArray[eN, iN-2]]
14564  */
14565  __pyx_t_18 = __pyx_v_eN;
14566  __pyx_t_19 = __pyx_v_iN;
14567  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_elementNodesArray.shape[0];
14568  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_elementNodesArray.shape[1];
14569  __pyx_t_9.data = __pyx_v_nodeArray.data;
14570  __pyx_t_9.memview = __pyx_v_nodeArray.memview;
14571  __PYX_INC_MEMVIEW(&__pyx_t_9, 0);
14572  {
14573  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_18 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_19 * __pyx_v_elementNodesArray.strides[1]) )));
14574  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
14575  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
14576  if (__pyx_tmp_idx < 0)
14577  __pyx_tmp_idx += __pyx_tmp_shape;
14578  if ((0)) __PYX_ERR(0, 996, __pyx_L1_error)
14579  __pyx_t_9.data += __pyx_tmp_idx * __pyx_tmp_stride;
14580 }
14581 
14582 __pyx_t_9.shape[0] = __pyx_v_nodeArray.shape[1];
14583 __pyx_t_9.strides[0] = __pyx_v_nodeArray.strides[1];
14584  __pyx_t_9.suboffsets[0] = -1;
14585 
14586 __PYX_XDEC_MEMVIEW(&__pyx_v_vec_a, 1);
14587  __pyx_v_vec_a = __pyx_t_9;
14588  __pyx_t_9.memview = NULL;
14589  __pyx_t_9.data = NULL;
14590 
14591  /* "mprans/MeshSmoothing.pyx":997
14592  * node = elementNodesArray[eN, iN]
14593  * vec_a = nodeArray[elementNodesArray[eN, iN]]
14594  * vec_b = nodeArray[elementNodesArray[eN, iN-1]] # <<<<<<<<<<<<<<
14595  * vec_c = nodeArray[elementNodesArray[eN, iN-2]]
14596  * A[0,0] = vec_b[0]-vec_a[0]
14597  */
14598  __pyx_t_20 = __pyx_v_eN;
14599  __pyx_t_21 = (__pyx_v_iN - 1);
14600  if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_elementNodesArray.shape[0];
14601  if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_elementNodesArray.shape[1];
14602  __pyx_t_9.data = __pyx_v_nodeArray.data;
14603  __pyx_t_9.memview = __pyx_v_nodeArray.memview;
14604  __PYX_INC_MEMVIEW(&__pyx_t_9, 0);
14605  {
14606  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_20 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_21 * __pyx_v_elementNodesArray.strides[1]) )));
14607  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
14608  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
14609  if (__pyx_tmp_idx < 0)
14610  __pyx_tmp_idx += __pyx_tmp_shape;
14611  if ((0)) __PYX_ERR(0, 997, __pyx_L1_error)
14612  __pyx_t_9.data += __pyx_tmp_idx * __pyx_tmp_stride;
14613 }
14614 
14615 __pyx_t_9.shape[0] = __pyx_v_nodeArray.shape[1];
14616 __pyx_t_9.strides[0] = __pyx_v_nodeArray.strides[1];
14617  __pyx_t_9.suboffsets[0] = -1;
14618 
14619 __PYX_XDEC_MEMVIEW(&__pyx_v_vec_b, 1);
14620  __pyx_v_vec_b = __pyx_t_9;
14621  __pyx_t_9.memview = NULL;
14622  __pyx_t_9.data = NULL;
14623 
14624  /* "mprans/MeshSmoothing.pyx":998
14625  * vec_a = nodeArray[elementNodesArray[eN, iN]]
14626  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
14627  * vec_c = nodeArray[elementNodesArray[eN, iN-2]] # <<<<<<<<<<<<<<
14628  * A[0,0] = vec_b[0]-vec_a[0]
14629  * A[1,0] = vec_b[1]-vec_a[1]
14630  */
14631  __pyx_t_22 = __pyx_v_eN;
14632  __pyx_t_23 = (__pyx_v_iN - 2);
14633  if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_elementNodesArray.shape[0];
14634  if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_elementNodesArray.shape[1];
14635  __pyx_t_9.data = __pyx_v_nodeArray.data;
14636  __pyx_t_9.memview = __pyx_v_nodeArray.memview;
14637  __PYX_INC_MEMVIEW(&__pyx_t_9, 0);
14638  {
14639  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_22 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_23 * __pyx_v_elementNodesArray.strides[1]) )));
14640  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
14641  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
14642  if (__pyx_tmp_idx < 0)
14643  __pyx_tmp_idx += __pyx_tmp_shape;
14644  if ((0)) __PYX_ERR(0, 998, __pyx_L1_error)
14645  __pyx_t_9.data += __pyx_tmp_idx * __pyx_tmp_stride;
14646 }
14647 
14648 __pyx_t_9.shape[0] = __pyx_v_nodeArray.shape[1];
14649 __pyx_t_9.strides[0] = __pyx_v_nodeArray.strides[1];
14650  __pyx_t_9.suboffsets[0] = -1;
14651 
14652 __PYX_XDEC_MEMVIEW(&__pyx_v_vec_c, 1);
14653  __pyx_v_vec_c = __pyx_t_9;
14654  __pyx_t_9.memview = NULL;
14655  __pyx_t_9.data = NULL;
14656 
14657  /* "mprans/MeshSmoothing.pyx":999
14658  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
14659  * vec_c = nodeArray[elementNodesArray[eN, iN-2]]
14660  * A[0,0] = vec_b[0]-vec_a[0] # <<<<<<<<<<<<<<
14661  * A[1,0] = vec_b[1]-vec_a[1]
14662  * A[0,1] = vec_c[0]-vec_a[0]
14663  */
14664  __pyx_t_24 = 0;
14665  if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_vec_b.shape[0];
14666  __pyx_t_25 = 0;
14667  if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_vec_a.shape[0];
14668  __pyx_t_26 = 0;
14669  __pyx_t_27 = 0;
14670  if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_A.shape[0];
14671  if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_A.shape[1];
14672  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_A.data + __pyx_t_26 * __pyx_v_A.strides[0]) ) + __pyx_t_27 * __pyx_v_A.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vec_b.data + __pyx_t_24 * __pyx_v_vec_b.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_vec_a.data + __pyx_t_25 * __pyx_v_vec_a.strides[0]) ))));
14673 
14674  /* "mprans/MeshSmoothing.pyx":1000
14675  * vec_c = nodeArray[elementNodesArray[eN, iN-2]]
14676  * A[0,0] = vec_b[0]-vec_a[0]
14677  * A[1,0] = vec_b[1]-vec_a[1] # <<<<<<<<<<<<<<
14678  * A[0,1] = vec_c[0]-vec_a[0]
14679  * A[1,1] = vec_c[1]-vec_a[1]
14680  */
14681  __pyx_t_28 = 1;
14682  if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_vec_b.shape[0];
14683  __pyx_t_29 = 1;
14684  if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_vec_a.shape[0];
14685  __pyx_t_30 = 1;
14686  __pyx_t_31 = 0;
14687  if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_A.shape[0];
14688  if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_A.shape[1];
14689  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_A.data + __pyx_t_30 * __pyx_v_A.strides[0]) ) + __pyx_t_31 * __pyx_v_A.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vec_b.data + __pyx_t_28 * __pyx_v_vec_b.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_vec_a.data + __pyx_t_29 * __pyx_v_vec_a.strides[0]) ))));
14690 
14691  /* "mprans/MeshSmoothing.pyx":1001
14692  * A[0,0] = vec_b[0]-vec_a[0]
14693  * A[1,0] = vec_b[1]-vec_a[1]
14694  * A[0,1] = vec_c[0]-vec_a[0] # <<<<<<<<<<<<<<
14695  * A[1,1] = vec_c[1]-vec_a[1]
14696  * AW = np.dot(A, np.linalg.inv(W))
14697  */
14698  __pyx_t_32 = 0;
14699  if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_vec_c.shape[0];
14700  __pyx_t_33 = 0;
14701  if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_vec_a.shape[0];
14702  __pyx_t_34 = 0;
14703  __pyx_t_35 = 1;
14704  if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_A.shape[0];
14705  if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_A.shape[1];
14706  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_A.data + __pyx_t_34 * __pyx_v_A.strides[0]) ) + __pyx_t_35 * __pyx_v_A.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vec_c.data + __pyx_t_32 * __pyx_v_vec_c.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_vec_a.data + __pyx_t_33 * __pyx_v_vec_a.strides[0]) ))));
14707 
14708  /* "mprans/MeshSmoothing.pyx":1002
14709  * A[1,0] = vec_b[1]-vec_a[1]
14710  * A[0,1] = vec_c[0]-vec_a[0]
14711  * A[1,1] = vec_c[1]-vec_a[1] # <<<<<<<<<<<<<<
14712  * AW = np.dot(A, np.linalg.inv(W))
14713  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0]))
14714  */
14715  __pyx_t_36 = 1;
14716  if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_vec_c.shape[0];
14717  __pyx_t_37 = 1;
14718  if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_vec_a.shape[0];
14719  __pyx_t_38 = 1;
14720  __pyx_t_39 = 1;
14721  if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_A.shape[0];
14722  if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_v_A.shape[1];
14723  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_A.data + __pyx_t_38 * __pyx_v_A.strides[0]) ) + __pyx_t_39 * __pyx_v_A.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vec_c.data + __pyx_t_36 * __pyx_v_vec_c.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_vec_a.data + __pyx_t_37 * __pyx_v_vec_a.strides[0]) ))));
14724 
14725  /* "mprans/MeshSmoothing.pyx":1003
14726  * A[0,1] = vec_c[0]-vec_a[0]
14727  * A[1,1] = vec_c[1]-vec_a[1]
14728  * AW = np.dot(A, np.linalg.inv(W)) # <<<<<<<<<<<<<<
14729  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0]))
14730  * IMRNodesArray_[node] += IMR
14731  */
14732  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1003, __pyx_L1_error)
14733  __Pyx_GOTREF(__pyx_t_3);
14734  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_dot); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1003, __pyx_L1_error)
14735  __Pyx_GOTREF(__pyx_t_4);
14736  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14737  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_A, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1003, __pyx_L1_error)
14738  __Pyx_GOTREF(__pyx_t_3);
14739  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1003, __pyx_L1_error)
14740  __Pyx_GOTREF(__pyx_t_2);
14741  __pyx_t_40 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_linalg); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1003, __pyx_L1_error)
14742  __Pyx_GOTREF(__pyx_t_40);
14743  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14744  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_40, __pyx_n_s_inv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1003, __pyx_L1_error)
14745  __Pyx_GOTREF(__pyx_t_2);
14746  __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
14747  __pyx_t_40 = __pyx_memoryview_fromslice(__pyx_v_W, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1003, __pyx_L1_error)
14748  __Pyx_GOTREF(__pyx_t_40);
14749  __pyx_t_41 = NULL;
14750  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
14751  __pyx_t_41 = PyMethod_GET_SELF(__pyx_t_2);
14752  if (likely(__pyx_t_41)) {
14753  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
14754  __Pyx_INCREF(__pyx_t_41);
14755  __Pyx_INCREF(function);
14756  __Pyx_DECREF_SET(__pyx_t_2, function);
14757  }
14758  }
14759  __pyx_t_5 = (__pyx_t_41) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_41, __pyx_t_40) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_40);
14760  __Pyx_XDECREF(__pyx_t_41); __pyx_t_41 = 0;
14761  __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
14762  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1003, __pyx_L1_error)
14763  __Pyx_GOTREF(__pyx_t_5);
14764  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14765  __pyx_t_2 = NULL;
14766  __pyx_t_42 = 0;
14767  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
14768  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
14769  if (likely(__pyx_t_2)) {
14770  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
14771  __Pyx_INCREF(__pyx_t_2);
14772  __Pyx_INCREF(function);
14773  __Pyx_DECREF_SET(__pyx_t_4, function);
14774  __pyx_t_42 = 1;
14775  }
14776  }
14777  #if CYTHON_FAST_PYCALL
14778  if (PyFunction_Check(__pyx_t_4)) {
14779  PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_3, __pyx_t_5};
14780  __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_42, 2+__pyx_t_42); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1003, __pyx_L1_error)
14781  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
14782  __Pyx_GOTREF(__pyx_t_1);
14783  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14784  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14785  } else
14786  #endif
14787  #if CYTHON_FAST_PYCCALL
14788  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
14789  PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_3, __pyx_t_5};
14790  __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_42, 2+__pyx_t_42); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1003, __pyx_L1_error)
14791  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
14792  __Pyx_GOTREF(__pyx_t_1);
14793  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14794  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14795  } else
14796  #endif
14797  {
14798  __pyx_t_40 = PyTuple_New(2+__pyx_t_42); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1003, __pyx_L1_error)
14799  __Pyx_GOTREF(__pyx_t_40);
14800  if (__pyx_t_2) {
14801  __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_40, 0, __pyx_t_2); __pyx_t_2 = NULL;
14802  }
14803  __Pyx_GIVEREF(__pyx_t_3);
14804  PyTuple_SET_ITEM(__pyx_t_40, 0+__pyx_t_42, __pyx_t_3);
14805  __Pyx_GIVEREF(__pyx_t_5);
14806  PyTuple_SET_ITEM(__pyx_t_40, 1+__pyx_t_42, __pyx_t_5);
14807  __pyx_t_3 = 0;
14808  __pyx_t_5 = 0;
14809  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_40, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1003, __pyx_L1_error)
14810  __Pyx_GOTREF(__pyx_t_1);
14811  __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
14812  }
14813  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14814  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1003, __pyx_L1_error)
14815  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14816  __PYX_XDEC_MEMVIEW(&__pyx_v_AW, 1);
14817  __pyx_v_AW = __pyx_t_6;
14818  __pyx_t_6.memview = NULL;
14819  __pyx_t_6.data = NULL;
14820 
14821  /* "mprans/MeshSmoothing.pyx":1004
14822  * A[1,1] = vec_c[1]-vec_a[1]
14823  * AW = np.dot(A, np.linalg.inv(W))
14824  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0])) # <<<<<<<<<<<<<<
14825  * IMRNodesArray_[node] += IMR
14826  * nElementsArray[node] += 1
14827  */
14828  __pyx_t_43 = 0;
14829  __pyx_t_44 = 0;
14830  if (__pyx_t_43 < 0) __pyx_t_43 += __pyx_v_AW.shape[0];
14831  if (__pyx_t_44 < 0) __pyx_t_44 += __pyx_v_AW.shape[1];
14832  __pyx_t_45 = 0;
14833  __pyx_t_46 = 1;
14834  if (__pyx_t_45 < 0) __pyx_t_45 += __pyx_v_AW.shape[0];
14835  if (__pyx_t_46 < 0) __pyx_t_46 += __pyx_v_AW.shape[1];
14836  __pyx_t_47 = 1;
14837  __pyx_t_48 = 0;
14838  if (__pyx_t_47 < 0) __pyx_t_47 += __pyx_v_AW.shape[0];
14839  if (__pyx_t_48 < 0) __pyx_t_48 += __pyx_v_AW.shape[1];
14840  __pyx_t_49 = 1;
14841  __pyx_t_50 = 1;
14842  if (__pyx_t_49 < 0) __pyx_t_49 += __pyx_v_AW.shape[0];
14843  if (__pyx_t_50 < 0) __pyx_t_50 += __pyx_v_AW.shape[1];
14844  __pyx_t_51 = 0;
14845  __pyx_t_52 = 0;
14846  if (__pyx_t_51 < 0) __pyx_t_51 += __pyx_v_AW.shape[0];
14847  if (__pyx_t_52 < 0) __pyx_t_52 += __pyx_v_AW.shape[1];
14848  __pyx_t_53 = 1;
14849  __pyx_t_54 = 1;
14850  if (__pyx_t_53 < 0) __pyx_t_53 += __pyx_v_AW.shape[0];
14851  if (__pyx_t_54 < 0) __pyx_t_54 += __pyx_v_AW.shape[1];
14852  __pyx_t_55 = 0;
14853  __pyx_t_56 = 1;
14854  if (__pyx_t_55 < 0) __pyx_t_55 += __pyx_v_AW.shape[0];
14855  if (__pyx_t_56 < 0) __pyx_t_56 += __pyx_v_AW.shape[1];
14856  __pyx_t_57 = 1;
14857  __pyx_t_58 = 0;
14858  if (__pyx_t_57 < 0) __pyx_t_57 += __pyx_v_AW.shape[0];
14859  if (__pyx_t_58 < 0) __pyx_t_58 += __pyx_v_AW.shape[1];
14860  __pyx_v_IMR = ((((pow((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_43 * __pyx_v_AW.strides[0]) ) + __pyx_t_44 * __pyx_v_AW.strides[1]) ))), 2.0) + pow((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_45 * __pyx_v_AW.strides[0]) ) + __pyx_t_46 * __pyx_v_AW.strides[1]) ))), 2.0)) + pow((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_47 * __pyx_v_AW.strides[0]) ) + __pyx_t_48 * __pyx_v_AW.strides[1]) ))), 2.0)) + pow((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_49 * __pyx_v_AW.strides[0]) ) + __pyx_t_50 * __pyx_v_AW.strides[1]) ))), 2.0)) / (2.0 * fabs((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_51 * __pyx_v_AW.strides[0]) ) + __pyx_t_52 * __pyx_v_AW.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_53 * __pyx_v_AW.strides[0]) ) + __pyx_t_54 * __pyx_v_AW.strides[1]) )))) - ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_55 * __pyx_v_AW.strides[0]) ) + __pyx_t_56 * __pyx_v_AW.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_57 * __pyx_v_AW.strides[0]) ) + __pyx_t_58 * __pyx_v_AW.strides[1]) ))))))));
14861 
14862  /* "mprans/MeshSmoothing.pyx":1005
14863  * AW = np.dot(A, np.linalg.inv(W))
14864  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0]))
14865  * IMRNodesArray_[node] += IMR # <<<<<<<<<<<<<<
14866  * nElementsArray[node] += 1
14867  * if el_average:
14868  */
14869  __pyx_t_59 = __pyx_v_node;
14870  if (__pyx_t_59 < 0) __pyx_t_59 += __pyx_v_IMRNodesArray_.shape[0];
14871  *((double *) ( /* dim=0 */ (__pyx_v_IMRNodesArray_.data + __pyx_t_59 * __pyx_v_IMRNodesArray_.strides[0]) )) += __pyx_v_IMR;
14872 
14873  /* "mprans/MeshSmoothing.pyx":1006
14874  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0]))
14875  * IMRNodesArray_[node] += IMR
14876  * nElementsArray[node] += 1 # <<<<<<<<<<<<<<
14877  * if el_average:
14878  * IMR_elements[eN] += IMR
14879  */
14880  __pyx_t_60 = __pyx_v_node;
14881  if (__pyx_t_60 < 0) __pyx_t_60 += __pyx_v_nElementsArray.shape[0];
14882  *((int *) ( /* dim=0 */ (__pyx_v_nElementsArray.data + __pyx_t_60 * __pyx_v_nElementsArray.strides[0]) )) += 1;
14883 
14884  /* "mprans/MeshSmoothing.pyx":1007
14885  * IMRNodesArray_[node] += IMR
14886  * nElementsArray[node] += 1
14887  * if el_average: # <<<<<<<<<<<<<<
14888  * IMR_elements[eN] += IMR
14889  * if el_average:
14890  */
14891  __pyx_t_8 = (__pyx_v_el_average != 0);
14892  if (__pyx_t_8) {
14893 
14894  /* "mprans/MeshSmoothing.pyx":1008
14895  * nElementsArray[node] += 1
14896  * if el_average:
14897  * IMR_elements[eN] += IMR # <<<<<<<<<<<<<<
14898  * if el_average:
14899  * IMR_elements[eN] = IMR_elements[eN]/3.
14900  */
14901  __pyx_t_61 = __pyx_v_eN;
14902  if (__pyx_t_61 < 0) __pyx_t_61 += __pyx_v_IMR_elements.shape[0];
14903  *((double *) ( /* dim=0 */ (__pyx_v_IMR_elements.data + __pyx_t_61 * __pyx_v_IMR_elements.strides[0]) )) += __pyx_v_IMR;
14904 
14905  /* "mprans/MeshSmoothing.pyx":1007
14906  * IMRNodesArray_[node] += IMR
14907  * nElementsArray[node] += 1
14908  * if el_average: # <<<<<<<<<<<<<<
14909  * IMR_elements[eN] += IMR
14910  * if el_average:
14911  */
14912  }
14913  }
14914 
14915  /* "mprans/MeshSmoothing.pyx":1009
14916  * if el_average:
14917  * IMR_elements[eN] += IMR
14918  * if el_average: # <<<<<<<<<<<<<<
14919  * IMR_elements[eN] = IMR_elements[eN]/3.
14920  * for node in range(nNodes):
14921  */
14922  __pyx_t_8 = (__pyx_v_el_average != 0);
14923  if (__pyx_t_8) {
14924 
14925  /* "mprans/MeshSmoothing.pyx":1010
14926  * IMR_elements[eN] += IMR
14927  * if el_average:
14928  * IMR_elements[eN] = IMR_elements[eN]/3. # <<<<<<<<<<<<<<
14929  * for node in range(nNodes):
14930  * if not el_average:
14931  */
14932  __pyx_t_62 = __pyx_v_eN;
14933  if (__pyx_t_62 < 0) __pyx_t_62 += __pyx_v_IMR_elements.shape[0];
14934  __pyx_t_63 = __pyx_v_eN;
14935  if (__pyx_t_63 < 0) __pyx_t_63 += __pyx_v_IMR_elements.shape[0];
14936  *((double *) ( /* dim=0 */ (__pyx_v_IMR_elements.data + __pyx_t_63 * __pyx_v_IMR_elements.strides[0]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_IMR_elements.data + __pyx_t_62 * __pyx_v_IMR_elements.strides[0]) ))) / 3.);
14937 
14938  /* "mprans/MeshSmoothing.pyx":1009
14939  * if el_average:
14940  * IMR_elements[eN] += IMR
14941  * if el_average: # <<<<<<<<<<<<<<
14942  * IMR_elements[eN] = IMR_elements[eN]/3.
14943  * for node in range(nNodes):
14944  */
14945  }
14946  }
14947 
14948  /* "mprans/MeshSmoothing.pyx":1011
14949  * if el_average:
14950  * IMR_elements[eN] = IMR_elements[eN]/3.
14951  * for node in range(nNodes): # <<<<<<<<<<<<<<
14952  * if not el_average:
14953  * IMRNodesArray_[node] = IMRNodesArray_[node]/nElementsArray[node]
14954  */
14955  __pyx_t_10 = __pyx_v_nNodes;
14956  __pyx_t_11 = __pyx_t_10;
14957  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
14958  __pyx_v_node = __pyx_t_12;
14959 
14960  /* "mprans/MeshSmoothing.pyx":1012
14961  * IMR_elements[eN] = IMR_elements[eN]/3.
14962  * for node in range(nNodes):
14963  * if not el_average: # <<<<<<<<<<<<<<
14964  * IMRNodesArray_[node] = IMRNodesArray_[node]/nElementsArray[node]
14965  * else:
14966  */
14967  __pyx_t_8 = ((!(__pyx_v_el_average != 0)) != 0);
14968  if (__pyx_t_8) {
14969 
14970  /* "mprans/MeshSmoothing.pyx":1013
14971  * for node in range(nNodes):
14972  * if not el_average:
14973  * IMRNodesArray_[node] = IMRNodesArray_[node]/nElementsArray[node] # <<<<<<<<<<<<<<
14974  * else:
14975  * nEl = 0
14976  */
14977  __pyx_t_64 = __pyx_v_node;
14978  if (__pyx_t_64 < 0) __pyx_t_64 += __pyx_v_IMRNodesArray_.shape[0];
14979  __pyx_t_65 = __pyx_v_node;
14980  if (__pyx_t_65 < 0) __pyx_t_65 += __pyx_v_nElementsArray.shape[0];
14981  __pyx_t_66 = __pyx_v_node;
14982  if (__pyx_t_66 < 0) __pyx_t_66 += __pyx_v_IMRNodesArray_.shape[0];
14983  *((double *) ( /* dim=0 */ (__pyx_v_IMRNodesArray_.data + __pyx_t_66 * __pyx_v_IMRNodesArray_.strides[0]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_IMRNodesArray_.data + __pyx_t_64 * __pyx_v_IMRNodesArray_.strides[0]) ))) / (*((int *) ( /* dim=0 */ (__pyx_v_nElementsArray.data + __pyx_t_65 * __pyx_v_nElementsArray.strides[0]) ))));
14984 
14985  /* "mprans/MeshSmoothing.pyx":1012
14986  * IMR_elements[eN] = IMR_elements[eN]/3.
14987  * for node in range(nNodes):
14988  * if not el_average: # <<<<<<<<<<<<<<
14989  * IMRNodesArray_[node] = IMRNodesArray_[node]/nElementsArray[node]
14990  * else:
14991  */
14992  goto __pyx_L12;
14993  }
14994 
14995  /* "mprans/MeshSmoothing.pyx":1015
14996  * IMRNodesArray_[node] = IMRNodesArray_[node]/nElementsArray[node]
14997  * else:
14998  * nEl = 0 # <<<<<<<<<<<<<<
14999  * IMRNodesArray_[node] = 0.
15000  * for eOffset in range(nodeElementOffsets[node],
15001  */
15002  /*else*/ {
15003  __pyx_v_nEl = 0;
15004 
15005  /* "mprans/MeshSmoothing.pyx":1016
15006  * else:
15007  * nEl = 0
15008  * IMRNodesArray_[node] = 0. # <<<<<<<<<<<<<<
15009  * for eOffset in range(nodeElementOffsets[node],
15010  * nodeElementOffsets[node+1]):
15011  */
15012  __pyx_t_67 = __pyx_v_node;
15013  if (__pyx_t_67 < 0) __pyx_t_67 += __pyx_v_IMRNodesArray_.shape[0];
15014  *((double *) ( /* dim=0 */ (__pyx_v_IMRNodesArray_.data + __pyx_t_67 * __pyx_v_IMRNodesArray_.strides[0]) )) = 0.;
15015 
15016  /* "mprans/MeshSmoothing.pyx":1018
15017  * IMRNodesArray_[node] = 0.
15018  * for eOffset in range(nodeElementOffsets[node],
15019  * nodeElementOffsets[node+1]): # <<<<<<<<<<<<<<
15020  * eN = nodeElementsArray[eOffset]
15021  * nEl += 1
15022  */
15023  __pyx_t_68 = (__pyx_v_node + 1);
15024  if (__pyx_t_68 < 0) __pyx_t_68 += __pyx_v_nodeElementOffsets.shape[0];
15025  __pyx_t_13 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_68 * __pyx_v_nodeElementOffsets.strides[0]) )));
15026 
15027  /* "mprans/MeshSmoothing.pyx":1017
15028  * nEl = 0
15029  * IMRNodesArray_[node] = 0.
15030  * for eOffset in range(nodeElementOffsets[node], # <<<<<<<<<<<<<<
15031  * nodeElementOffsets[node+1]):
15032  * eN = nodeElementsArray[eOffset]
15033  */
15034  __pyx_t_69 = __pyx_v_node;
15035  if (__pyx_t_69 < 0) __pyx_t_69 += __pyx_v_nodeElementOffsets.shape[0];
15036 
15037  /* "mprans/MeshSmoothing.pyx":1018
15038  * IMRNodesArray_[node] = 0.
15039  * for eOffset in range(nodeElementOffsets[node],
15040  * nodeElementOffsets[node+1]): # <<<<<<<<<<<<<<
15041  * eN = nodeElementsArray[eOffset]
15042  * nEl += 1
15043  */
15044  __pyx_t_14 = __pyx_t_13;
15045  for (__pyx_t_15 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_69 * __pyx_v_nodeElementOffsets.strides[0]) ))); __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
15046 
15047  /* "mprans/MeshSmoothing.pyx":1017
15048  * nEl = 0
15049  * IMRNodesArray_[node] = 0.
15050  * for eOffset in range(nodeElementOffsets[node], # <<<<<<<<<<<<<<
15051  * nodeElementOffsets[node+1]):
15052  * eN = nodeElementsArray[eOffset]
15053  */
15054  __pyx_v_eOffset = __pyx_t_15;
15055 
15056  /* "mprans/MeshSmoothing.pyx":1019
15057  * for eOffset in range(nodeElementOffsets[node],
15058  * nodeElementOffsets[node+1]):
15059  * eN = nodeElementsArray[eOffset] # <<<<<<<<<<<<<<
15060  * nEl += 1
15061  * IMRNodesArray_[node] += IMR_elements[eN]
15062  */
15063  __pyx_t_70 = __pyx_v_eOffset;
15064  if (__pyx_t_70 < 0) __pyx_t_70 += __pyx_v_nodeElementsArray.shape[0];
15065  __pyx_v_eN = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementsArray.data + __pyx_t_70 * __pyx_v_nodeElementsArray.strides[0]) )));
15066 
15067  /* "mprans/MeshSmoothing.pyx":1020
15068  * nodeElementOffsets[node+1]):
15069  * eN = nodeElementsArray[eOffset]
15070  * nEl += 1 # <<<<<<<<<<<<<<
15071  * IMRNodesArray_[node] += IMR_elements[eN]
15072  * IMRNodesArray_[node] = IMRNodesArray_[node]/nEl
15073  */
15074  __pyx_v_nEl = (__pyx_v_nEl + 1);
15075 
15076  /* "mprans/MeshSmoothing.pyx":1021
15077  * eN = nodeElementsArray[eOffset]
15078  * nEl += 1
15079  * IMRNodesArray_[node] += IMR_elements[eN] # <<<<<<<<<<<<<<
15080  * IMRNodesArray_[node] = IMRNodesArray_[node]/nEl
15081  *
15082  */
15083  __pyx_t_71 = __pyx_v_eN;
15084  if (__pyx_t_71 < 0) __pyx_t_71 += __pyx_v_IMR_elements.shape[0];
15085  __pyx_t_72 = __pyx_v_node;
15086  if (__pyx_t_72 < 0) __pyx_t_72 += __pyx_v_IMRNodesArray_.shape[0];
15087  *((double *) ( /* dim=0 */ (__pyx_v_IMRNodesArray_.data + __pyx_t_72 * __pyx_v_IMRNodesArray_.strides[0]) )) += (*((double *) ( /* dim=0 */ (__pyx_v_IMR_elements.data + __pyx_t_71 * __pyx_v_IMR_elements.strides[0]) )));
15088  }
15089 
15090  /* "mprans/MeshSmoothing.pyx":1022
15091  * nEl += 1
15092  * IMRNodesArray_[node] += IMR_elements[eN]
15093  * IMRNodesArray_[node] = IMRNodesArray_[node]/nEl # <<<<<<<<<<<<<<
15094  *
15095  * cdef void cyUpdateInverseMeanRatioTriangleElements(double[:] IMRElementsArray_,
15096  */
15097  __pyx_t_73 = __pyx_v_node;
15098  if (__pyx_t_73 < 0) __pyx_t_73 += __pyx_v_IMRNodesArray_.shape[0];
15099  __pyx_t_74 = __pyx_v_node;
15100  if (__pyx_t_74 < 0) __pyx_t_74 += __pyx_v_IMRNodesArray_.shape[0];
15101  *((double *) ( /* dim=0 */ (__pyx_v_IMRNodesArray_.data + __pyx_t_74 * __pyx_v_IMRNodesArray_.strides[0]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_IMRNodesArray_.data + __pyx_t_73 * __pyx_v_IMRNodesArray_.strides[0]) ))) / __pyx_v_nEl);
15102  }
15103  __pyx_L12:;
15104  }
15105 
15106  /* "mprans/MeshSmoothing.pyx":967
15107  * elementDistortionArray_[eN] = (1./nd*trJTJ)**(nd/2.)/detJ
15108  *
15109  * cdef void cyUpdateInverseMeanRatioTriangleNodes(double[:] IMRNodesArray_, # <<<<<<<<<<<<<<
15110  * double[:,:] nodeArray,
15111  * int[:,:] elementNodesArray,
15112  */
15113 
15114  /* function exit code */
15115  goto __pyx_L0;
15116  __pyx_L1_error:;
15117  __Pyx_XDECREF(__pyx_t_1);
15118  __Pyx_XDECREF(__pyx_t_2);
15119  __Pyx_XDECREF(__pyx_t_3);
15120  __Pyx_XDECREF(__pyx_t_4);
15121  __Pyx_XDECREF(__pyx_t_5);
15122  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
15123  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
15124  __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
15125  __Pyx_XDECREF(__pyx_t_40);
15126  __Pyx_XDECREF(__pyx_t_41);
15127  __Pyx_WriteUnraisable("mprans.MeshSmoothing.cyUpdateInverseMeanRatioTriangleNodes", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
15128  __pyx_L0:;
15129  __PYX_XDEC_MEMVIEW(&__pyx_v_W, 1);
15130  __PYX_XDEC_MEMVIEW(&__pyx_v_A, 1);
15131  __PYX_XDEC_MEMVIEW(&__pyx_v_AW, 1);
15132  __PYX_XDEC_MEMVIEW(&__pyx_v_nElementsArray, 1);
15133  __PYX_XDEC_MEMVIEW(&__pyx_v_IMR_elements, 1);
15134  __PYX_XDEC_MEMVIEW(&__pyx_v_vec_a, 1);
15135  __PYX_XDEC_MEMVIEW(&__pyx_v_vec_b, 1);
15136  __PYX_XDEC_MEMVIEW(&__pyx_v_vec_c, 1);
15137  __Pyx_RefNannyFinishContext();
15138 }
15139 
15140 /* "mprans/MeshSmoothing.pyx":1024
15141  * IMRNodesArray_[node] = IMRNodesArray_[node]/nEl
15142  *
15143  * cdef void cyUpdateInverseMeanRatioTriangleElements(double[:] IMRElementsArray_, # <<<<<<<<<<<<<<
15144  * double[:,:] nodeArray,
15145  * int[:,:] elementNodesArray,
15146  */
15147 
15148 static void __pyx_f_6mprans_13MeshSmoothing_cyUpdateInverseMeanRatioTriangleElements(__Pyx_memviewslice __pyx_v_IMRElementsArray_, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementNodesArray, int __pyx_v_nElements) {
15149  __Pyx_memviewslice __pyx_v_W = { 0, 0, { 0 }, { 0 }, { 0 } };
15150  __Pyx_memviewslice __pyx_v_A = { 0, 0, { 0 }, { 0 }, { 0 } };
15151  __Pyx_memviewslice __pyx_v_AW = { 0, 0, { 0 }, { 0 }, { 0 } };
15152  __Pyx_memviewslice __pyx_v_vec_a = { 0, 0, { 0 }, { 0 }, { 0 } };
15153  __Pyx_memviewslice __pyx_v_vec_b = { 0, 0, { 0 }, { 0 }, { 0 } };
15154  __Pyx_memviewslice __pyx_v_vec_c = { 0, 0, { 0 }, { 0 }, { 0 } };
15155  double __pyx_v_IMR;
15156  CYTHON_UNUSED int __pyx_v_nEl;
15157  int __pyx_v_eN;
15158  int __pyx_v_iN;
15159  CYTHON_UNUSED int __pyx_v_node;
15160  __Pyx_RefNannyDeclarations
15161  PyObject *__pyx_t_1 = NULL;
15162  PyObject *__pyx_t_2 = NULL;
15163  PyObject *__pyx_t_3 = NULL;
15164  PyObject *__pyx_t_4 = NULL;
15165  PyObject *__pyx_t_5 = NULL;
15166  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
15167  int __pyx_t_7;
15168  int __pyx_t_8;
15169  int __pyx_t_9;
15170  int __pyx_t_10;
15171  __Pyx_memviewslice __pyx_t_11 = { 0, 0, { 0 }, { 0 }, { 0 } };
15172  Py_ssize_t __pyx_t_12;
15173  PyObject *(*__pyx_t_13)(PyObject *);
15174  int __pyx_t_14;
15175  Py_ssize_t __pyx_t_15;
15176  Py_ssize_t __pyx_t_16;
15177  __Pyx_memviewslice __pyx_t_17 = { 0, 0, { 0 }, { 0 }, { 0 } };
15178  Py_ssize_t __pyx_t_18;
15179  Py_ssize_t __pyx_t_19;
15180  Py_ssize_t __pyx_t_20;
15181  Py_ssize_t __pyx_t_21;
15182  Py_ssize_t __pyx_t_22;
15183  Py_ssize_t __pyx_t_23;
15184  Py_ssize_t __pyx_t_24;
15185  Py_ssize_t __pyx_t_25;
15186  Py_ssize_t __pyx_t_26;
15187  Py_ssize_t __pyx_t_27;
15188  Py_ssize_t __pyx_t_28;
15189  Py_ssize_t __pyx_t_29;
15190  Py_ssize_t __pyx_t_30;
15191  Py_ssize_t __pyx_t_31;
15192  Py_ssize_t __pyx_t_32;
15193  Py_ssize_t __pyx_t_33;
15194  Py_ssize_t __pyx_t_34;
15195  Py_ssize_t __pyx_t_35;
15196  Py_ssize_t __pyx_t_36;
15197  Py_ssize_t __pyx_t_37;
15198  PyObject *__pyx_t_38 = NULL;
15199  PyObject *__pyx_t_39 = NULL;
15200  PyObject *__pyx_t_40 = NULL;
15201  Py_ssize_t __pyx_t_41;
15202  Py_ssize_t __pyx_t_42;
15203  Py_ssize_t __pyx_t_43;
15204  Py_ssize_t __pyx_t_44;
15205  Py_ssize_t __pyx_t_45;
15206  Py_ssize_t __pyx_t_46;
15207  Py_ssize_t __pyx_t_47;
15208  Py_ssize_t __pyx_t_48;
15209  Py_ssize_t __pyx_t_49;
15210  Py_ssize_t __pyx_t_50;
15211  Py_ssize_t __pyx_t_51;
15212  Py_ssize_t __pyx_t_52;
15213  Py_ssize_t __pyx_t_53;
15214  Py_ssize_t __pyx_t_54;
15215  Py_ssize_t __pyx_t_55;
15216  Py_ssize_t __pyx_t_56;
15217  Py_ssize_t __pyx_t_57;
15218  Py_ssize_t __pyx_t_58;
15219  Py_ssize_t __pyx_t_59;
15220  __Pyx_RefNannySetupContext("cyUpdateInverseMeanRatioTriangleElements", 0);
15221 
15222  /* "mprans/MeshSmoothing.pyx":1028
15223  * int[:,:] elementNodesArray,
15224  * int nElements):
15225  * cdef double[:,:] W = np.array([[1., 0.5], # <<<<<<<<<<<<<<
15226  * [0., sqrt(3)/2.]])
15227  * cdef double[:,:] A = np.zeros((2,2))
15228  */
15229  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1028, __pyx_L1_error)
15230  __Pyx_GOTREF(__pyx_t_2);
15231  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1028, __pyx_L1_error)
15232  __Pyx_GOTREF(__pyx_t_3);
15233  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15234  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1028, __pyx_L1_error)
15235  __Pyx_GOTREF(__pyx_t_2);
15236  __Pyx_INCREF(__pyx_float_1_);
15237  __Pyx_GIVEREF(__pyx_float_1_);
15238  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_float_1_);
15239  __Pyx_INCREF(__pyx_float_0_5);
15240  __Pyx_GIVEREF(__pyx_float_0_5);
15241  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_float_0_5);
15242 
15243  /* "mprans/MeshSmoothing.pyx":1029
15244  * int nElements):
15245  * cdef double[:,:] W = np.array([[1., 0.5],
15246  * [0., sqrt(3)/2.]]) # <<<<<<<<<<<<<<
15247  * cdef double[:,:] A = np.zeros((2,2))
15248  * cdef double[:,:] AW = np.zeros((2,2))
15249  */
15250  __pyx_t_4 = PyFloat_FromDouble((sqrt(3.0) / 2.)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1029, __pyx_L1_error)
15251  __Pyx_GOTREF(__pyx_t_4);
15252  __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1029, __pyx_L1_error)
15253  __Pyx_GOTREF(__pyx_t_5);
15254  __Pyx_INCREF(__pyx_float_0_);
15255  __Pyx_GIVEREF(__pyx_float_0_);
15256  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_float_0_);
15257  __Pyx_GIVEREF(__pyx_t_4);
15258  PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
15259  __pyx_t_4 = 0;
15260 
15261  /* "mprans/MeshSmoothing.pyx":1028
15262  * int[:,:] elementNodesArray,
15263  * int nElements):
15264  * cdef double[:,:] W = np.array([[1., 0.5], # <<<<<<<<<<<<<<
15265  * [0., sqrt(3)/2.]])
15266  * cdef double[:,:] A = np.zeros((2,2))
15267  */
15268  __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1028, __pyx_L1_error)
15269  __Pyx_GOTREF(__pyx_t_4);
15270  __Pyx_GIVEREF(__pyx_t_2);
15271  PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
15272  __Pyx_GIVEREF(__pyx_t_5);
15273  PyList_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
15274  __pyx_t_2 = 0;
15275  __pyx_t_5 = 0;
15276  __pyx_t_5 = NULL;
15277  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
15278  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
15279  if (likely(__pyx_t_5)) {
15280  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
15281  __Pyx_INCREF(__pyx_t_5);
15282  __Pyx_INCREF(function);
15283  __Pyx_DECREF_SET(__pyx_t_3, function);
15284  }
15285  }
15286  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
15287  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
15288  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15289  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1028, __pyx_L1_error)
15290  __Pyx_GOTREF(__pyx_t_1);
15291  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15292  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1028, __pyx_L1_error)
15293  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15294  __pyx_v_W = __pyx_t_6;
15295  __pyx_t_6.memview = NULL;
15296  __pyx_t_6.data = NULL;
15297 
15298  /* "mprans/MeshSmoothing.pyx":1030
15299  * cdef double[:,:] W = np.array([[1., 0.5],
15300  * [0., sqrt(3)/2.]])
15301  * cdef double[:,:] A = np.zeros((2,2)) # <<<<<<<<<<<<<<
15302  * cdef double[:,:] AW = np.zeros((2,2))
15303  * cdef double[:] vec_a
15304  */
15305  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1030, __pyx_L1_error)
15306  __Pyx_GOTREF(__pyx_t_3);
15307  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1030, __pyx_L1_error)
15308  __Pyx_GOTREF(__pyx_t_4);
15309  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15310  __pyx_t_3 = NULL;
15311  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
15312  __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
15313  if (likely(__pyx_t_3)) {
15314  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
15315  __Pyx_INCREF(__pyx_t_3);
15316  __Pyx_INCREF(function);
15317  __Pyx_DECREF_SET(__pyx_t_4, function);
15318  }
15319  }
15320  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_tuple__6) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_tuple__6);
15321  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
15322  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1030, __pyx_L1_error)
15323  __Pyx_GOTREF(__pyx_t_1);
15324  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15325  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1030, __pyx_L1_error)
15326  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15327  __pyx_v_A = __pyx_t_6;
15328  __pyx_t_6.memview = NULL;
15329  __pyx_t_6.data = NULL;
15330 
15331  /* "mprans/MeshSmoothing.pyx":1031
15332  * [0., sqrt(3)/2.]])
15333  * cdef double[:,:] A = np.zeros((2,2))
15334  * cdef double[:,:] AW = np.zeros((2,2)) # <<<<<<<<<<<<<<
15335  * cdef double[:] vec_a
15336  * cdef double[:] vec_b
15337  */
15338  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1031, __pyx_L1_error)
15339  __Pyx_GOTREF(__pyx_t_4);
15340  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1031, __pyx_L1_error)
15341  __Pyx_GOTREF(__pyx_t_3);
15342  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15343  __pyx_t_4 = NULL;
15344  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
15345  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
15346  if (likely(__pyx_t_4)) {
15347  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
15348  __Pyx_INCREF(__pyx_t_4);
15349  __Pyx_INCREF(function);
15350  __Pyx_DECREF_SET(__pyx_t_3, function);
15351  }
15352  }
15353  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_tuple__6) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_tuple__6);
15354  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
15355  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1031, __pyx_L1_error)
15356  __Pyx_GOTREF(__pyx_t_1);
15357  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15358  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1031, __pyx_L1_error)
15359  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15360  __pyx_v_AW = __pyx_t_6;
15361  __pyx_t_6.memview = NULL;
15362  __pyx_t_6.data = NULL;
15363 
15364  /* "mprans/MeshSmoothing.pyx":1036
15365  * cdef double[:] vec_c
15366  * cdef double IMR
15367  * cdef int nEl = 0 # <<<<<<<<<<<<<<
15368  * cdef int eN
15369  * cdef int iN
15370  */
15371  __pyx_v_nEl = 0;
15372 
15373  /* "mprans/MeshSmoothing.pyx":1040
15374  * cdef int iN
15375  * cdef int node
15376  * for eN in range(nElements): # <<<<<<<<<<<<<<
15377  * for iN, node in enumerate(elementNodesArray[eN]):
15378  * vec_a = nodeArray[elementNodesArray[eN, iN]]
15379  */
15380  __pyx_t_7 = __pyx_v_nElements;
15381  __pyx_t_8 = __pyx_t_7;
15382  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
15383  __pyx_v_eN = __pyx_t_9;
15384 
15385  /* "mprans/MeshSmoothing.pyx":1041
15386  * cdef int node
15387  * for eN in range(nElements):
15388  * for iN, node in enumerate(elementNodesArray[eN]): # <<<<<<<<<<<<<<
15389  * vec_a = nodeArray[elementNodesArray[eN, iN]]
15390  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
15391  */
15392  __pyx_t_10 = 0;
15393  __pyx_t_11.data = __pyx_v_elementNodesArray.data;
15394  __pyx_t_11.memview = __pyx_v_elementNodesArray.memview;
15395  __PYX_INC_MEMVIEW(&__pyx_t_11, 0);
15396  {
15397  Py_ssize_t __pyx_tmp_idx = __pyx_v_eN;
15398  Py_ssize_t __pyx_tmp_shape = __pyx_v_elementNodesArray.shape[0];
15399  Py_ssize_t __pyx_tmp_stride = __pyx_v_elementNodesArray.strides[0];
15400  if (__pyx_tmp_idx < 0)
15401  __pyx_tmp_idx += __pyx_tmp_shape;
15402  if ((0)) __PYX_ERR(0, 1041, __pyx_L1_error)
15403  __pyx_t_11.data += __pyx_tmp_idx * __pyx_tmp_stride;
15404 }
15405 
15406 __pyx_t_11.shape[0] = __pyx_v_elementNodesArray.shape[1];
15407 __pyx_t_11.strides[0] = __pyx_v_elementNodesArray.strides[1];
15408  __pyx_t_11.suboffsets[0] = -1;
15409 
15410 __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_t_11, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1041, __pyx_L1_error)
15411  __Pyx_GOTREF(__pyx_t_1);
15412  __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
15413  __pyx_t_11.memview = NULL;
15414  __pyx_t_11.data = NULL;
15415  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
15416  __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_12 = 0;
15417  __pyx_t_13 = NULL;
15418  } else {
15419  __pyx_t_12 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1041, __pyx_L1_error)
15420  __Pyx_GOTREF(__pyx_t_3);
15421  __pyx_t_13 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1041, __pyx_L1_error)
15422  }
15423  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15424  for (;;) {
15425  if (likely(!__pyx_t_13)) {
15426  if (likely(PyList_CheckExact(__pyx_t_3))) {
15427  if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_3)) break;
15428  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
15429  __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_12); __Pyx_INCREF(__pyx_t_1); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1041, __pyx_L1_error)
15430  #else
15431  __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1041, __pyx_L1_error)
15432  __Pyx_GOTREF(__pyx_t_1);
15433  #endif
15434  } else {
15435  if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
15436  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
15437  __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_12); __Pyx_INCREF(__pyx_t_1); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1041, __pyx_L1_error)
15438  #else
15439  __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1041, __pyx_L1_error)
15440  __Pyx_GOTREF(__pyx_t_1);
15441  #endif
15442  }
15443  } else {
15444  __pyx_t_1 = __pyx_t_13(__pyx_t_3);
15445  if (unlikely(!__pyx_t_1)) {
15446  PyObject* exc_type = PyErr_Occurred();
15447  if (exc_type) {
15448  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
15449  else __PYX_ERR(0, 1041, __pyx_L1_error)
15450  }
15451  break;
15452  }
15453  __Pyx_GOTREF(__pyx_t_1);
15454  }
15455  __pyx_t_14 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1041, __pyx_L1_error)
15456  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15457  __pyx_v_node = __pyx_t_14;
15458  __pyx_v_iN = __pyx_t_10;
15459  __pyx_t_10 = (__pyx_t_10 + 1);
15460 
15461  /* "mprans/MeshSmoothing.pyx":1042
15462  * for eN in range(nElements):
15463  * for iN, node in enumerate(elementNodesArray[eN]):
15464  * vec_a = nodeArray[elementNodesArray[eN, iN]] # <<<<<<<<<<<<<<
15465  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
15466  * vec_c = nodeArray[elementNodesArray[eN, iN-2]]
15467  */
15468  __pyx_t_15 = __pyx_v_eN;
15469  __pyx_t_16 = __pyx_v_iN;
15470  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_elementNodesArray.shape[0];
15471  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_elementNodesArray.shape[1];
15472  __pyx_t_17.data = __pyx_v_nodeArray.data;
15473  __pyx_t_17.memview = __pyx_v_nodeArray.memview;
15474  __PYX_INC_MEMVIEW(&__pyx_t_17, 0);
15475  {
15476  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_15 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_16 * __pyx_v_elementNodesArray.strides[1]) )));
15477  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
15478  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
15479  if (__pyx_tmp_idx < 0)
15480  __pyx_tmp_idx += __pyx_tmp_shape;
15481  if ((0)) __PYX_ERR(0, 1042, __pyx_L1_error)
15482  __pyx_t_17.data += __pyx_tmp_idx * __pyx_tmp_stride;
15483 }
15484 
15485 __pyx_t_17.shape[0] = __pyx_v_nodeArray.shape[1];
15486 __pyx_t_17.strides[0] = __pyx_v_nodeArray.strides[1];
15487  __pyx_t_17.suboffsets[0] = -1;
15488 
15489 __PYX_XDEC_MEMVIEW(&__pyx_v_vec_a, 1);
15490  __pyx_v_vec_a = __pyx_t_17;
15491  __pyx_t_17.memview = NULL;
15492  __pyx_t_17.data = NULL;
15493 
15494  /* "mprans/MeshSmoothing.pyx":1043
15495  * for iN, node in enumerate(elementNodesArray[eN]):
15496  * vec_a = nodeArray[elementNodesArray[eN, iN]]
15497  * vec_b = nodeArray[elementNodesArray[eN, iN-1]] # <<<<<<<<<<<<<<
15498  * vec_c = nodeArray[elementNodesArray[eN, iN-2]]
15499  * A[0,0] = vec_b[0]-vec_a[0]
15500  */
15501  __pyx_t_18 = __pyx_v_eN;
15502  __pyx_t_19 = (__pyx_v_iN - 1);
15503  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_elementNodesArray.shape[0];
15504  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_elementNodesArray.shape[1];
15505  __pyx_t_17.data = __pyx_v_nodeArray.data;
15506  __pyx_t_17.memview = __pyx_v_nodeArray.memview;
15507  __PYX_INC_MEMVIEW(&__pyx_t_17, 0);
15508  {
15509  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_18 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_19 * __pyx_v_elementNodesArray.strides[1]) )));
15510  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
15511  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
15512  if (__pyx_tmp_idx < 0)
15513  __pyx_tmp_idx += __pyx_tmp_shape;
15514  if ((0)) __PYX_ERR(0, 1043, __pyx_L1_error)
15515  __pyx_t_17.data += __pyx_tmp_idx * __pyx_tmp_stride;
15516 }
15517 
15518 __pyx_t_17.shape[0] = __pyx_v_nodeArray.shape[1];
15519 __pyx_t_17.strides[0] = __pyx_v_nodeArray.strides[1];
15520  __pyx_t_17.suboffsets[0] = -1;
15521 
15522 __PYX_XDEC_MEMVIEW(&__pyx_v_vec_b, 1);
15523  __pyx_v_vec_b = __pyx_t_17;
15524  __pyx_t_17.memview = NULL;
15525  __pyx_t_17.data = NULL;
15526 
15527  /* "mprans/MeshSmoothing.pyx":1044
15528  * vec_a = nodeArray[elementNodesArray[eN, iN]]
15529  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
15530  * vec_c = nodeArray[elementNodesArray[eN, iN-2]] # <<<<<<<<<<<<<<
15531  * A[0,0] = vec_b[0]-vec_a[0]
15532  * A[1,0] = vec_b[1]-vec_a[1]
15533  */
15534  __pyx_t_20 = __pyx_v_eN;
15535  __pyx_t_21 = (__pyx_v_iN - 2);
15536  if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_elementNodesArray.shape[0];
15537  if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_elementNodesArray.shape[1];
15538  __pyx_t_17.data = __pyx_v_nodeArray.data;
15539  __pyx_t_17.memview = __pyx_v_nodeArray.memview;
15540  __PYX_INC_MEMVIEW(&__pyx_t_17, 0);
15541  {
15542  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_20 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_21 * __pyx_v_elementNodesArray.strides[1]) )));
15543  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
15544  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
15545  if (__pyx_tmp_idx < 0)
15546  __pyx_tmp_idx += __pyx_tmp_shape;
15547  if ((0)) __PYX_ERR(0, 1044, __pyx_L1_error)
15548  __pyx_t_17.data += __pyx_tmp_idx * __pyx_tmp_stride;
15549 }
15550 
15551 __pyx_t_17.shape[0] = __pyx_v_nodeArray.shape[1];
15552 __pyx_t_17.strides[0] = __pyx_v_nodeArray.strides[1];
15553  __pyx_t_17.suboffsets[0] = -1;
15554 
15555 __PYX_XDEC_MEMVIEW(&__pyx_v_vec_c, 1);
15556  __pyx_v_vec_c = __pyx_t_17;
15557  __pyx_t_17.memview = NULL;
15558  __pyx_t_17.data = NULL;
15559 
15560  /* "mprans/MeshSmoothing.pyx":1045
15561  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
15562  * vec_c = nodeArray[elementNodesArray[eN, iN-2]]
15563  * A[0,0] = vec_b[0]-vec_a[0] # <<<<<<<<<<<<<<
15564  * A[1,0] = vec_b[1]-vec_a[1]
15565  * A[0,1] = vec_c[0]-vec_a[0]
15566  */
15567  __pyx_t_22 = 0;
15568  if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_vec_b.shape[0];
15569  __pyx_t_23 = 0;
15570  if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_vec_a.shape[0];
15571  __pyx_t_24 = 0;
15572  __pyx_t_25 = 0;
15573  if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_A.shape[0];
15574  if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_A.shape[1];
15575  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_A.data + __pyx_t_24 * __pyx_v_A.strides[0]) ) + __pyx_t_25 * __pyx_v_A.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vec_b.data + __pyx_t_22 * __pyx_v_vec_b.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_vec_a.data + __pyx_t_23 * __pyx_v_vec_a.strides[0]) ))));
15576 
15577  /* "mprans/MeshSmoothing.pyx":1046
15578  * vec_c = nodeArray[elementNodesArray[eN, iN-2]]
15579  * A[0,0] = vec_b[0]-vec_a[0]
15580  * A[1,0] = vec_b[1]-vec_a[1] # <<<<<<<<<<<<<<
15581  * A[0,1] = vec_c[0]-vec_a[0]
15582  * A[1,1] = vec_c[1]-vec_a[1]
15583  */
15584  __pyx_t_26 = 1;
15585  if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_vec_b.shape[0];
15586  __pyx_t_27 = 1;
15587  if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_vec_a.shape[0];
15588  __pyx_t_28 = 1;
15589  __pyx_t_29 = 0;
15590  if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_A.shape[0];
15591  if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_A.shape[1];
15592  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_A.data + __pyx_t_28 * __pyx_v_A.strides[0]) ) + __pyx_t_29 * __pyx_v_A.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vec_b.data + __pyx_t_26 * __pyx_v_vec_b.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_vec_a.data + __pyx_t_27 * __pyx_v_vec_a.strides[0]) ))));
15593 
15594  /* "mprans/MeshSmoothing.pyx":1047
15595  * A[0,0] = vec_b[0]-vec_a[0]
15596  * A[1,0] = vec_b[1]-vec_a[1]
15597  * A[0,1] = vec_c[0]-vec_a[0] # <<<<<<<<<<<<<<
15598  * A[1,1] = vec_c[1]-vec_a[1]
15599  * AW = np.dot(A, np.linalg.inv(W))
15600  */
15601  __pyx_t_30 = 0;
15602  if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_vec_c.shape[0];
15603  __pyx_t_31 = 0;
15604  if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_vec_a.shape[0];
15605  __pyx_t_32 = 0;
15606  __pyx_t_33 = 1;
15607  if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_A.shape[0];
15608  if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_A.shape[1];
15609  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_A.data + __pyx_t_32 * __pyx_v_A.strides[0]) ) + __pyx_t_33 * __pyx_v_A.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vec_c.data + __pyx_t_30 * __pyx_v_vec_c.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_vec_a.data + __pyx_t_31 * __pyx_v_vec_a.strides[0]) ))));
15610 
15611  /* "mprans/MeshSmoothing.pyx":1048
15612  * A[1,0] = vec_b[1]-vec_a[1]
15613  * A[0,1] = vec_c[0]-vec_a[0]
15614  * A[1,1] = vec_c[1]-vec_a[1] # <<<<<<<<<<<<<<
15615  * AW = np.dot(A, np.linalg.inv(W))
15616  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0]))
15617  */
15618  __pyx_t_34 = 1;
15619  if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_vec_c.shape[0];
15620  __pyx_t_35 = 1;
15621  if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_vec_a.shape[0];
15622  __pyx_t_36 = 1;
15623  __pyx_t_37 = 1;
15624  if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_A.shape[0];
15625  if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_A.shape[1];
15626  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_A.data + __pyx_t_36 * __pyx_v_A.strides[0]) ) + __pyx_t_37 * __pyx_v_A.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vec_c.data + __pyx_t_34 * __pyx_v_vec_c.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_vec_a.data + __pyx_t_35 * __pyx_v_vec_a.strides[0]) ))));
15627 
15628  /* "mprans/MeshSmoothing.pyx":1049
15629  * A[0,1] = vec_c[0]-vec_a[0]
15630  * A[1,1] = vec_c[1]-vec_a[1]
15631  * AW = np.dot(A, np.linalg.inv(W)) # <<<<<<<<<<<<<<
15632  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0]))
15633  * IMRElementsArray_[eN] += IMR
15634  */
15635  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1049, __pyx_L1_error)
15636  __Pyx_GOTREF(__pyx_t_4);
15637  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_dot); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1049, __pyx_L1_error)
15638  __Pyx_GOTREF(__pyx_t_5);
15639  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15640  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_A, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1049, __pyx_L1_error)
15641  __Pyx_GOTREF(__pyx_t_4);
15642  __Pyx_GetModuleGlobalName(__pyx_t_38, __pyx_n_s_np); if (unlikely(!__pyx_t_38)) __PYX_ERR(0, 1049, __pyx_L1_error)
15643  __Pyx_GOTREF(__pyx_t_38);
15644  __pyx_t_39 = __Pyx_PyObject_GetAttrStr(__pyx_t_38, __pyx_n_s_linalg); if (unlikely(!__pyx_t_39)) __PYX_ERR(0, 1049, __pyx_L1_error)
15645  __Pyx_GOTREF(__pyx_t_39);
15646  __Pyx_DECREF(__pyx_t_38); __pyx_t_38 = 0;
15647  __pyx_t_38 = __Pyx_PyObject_GetAttrStr(__pyx_t_39, __pyx_n_s_inv); if (unlikely(!__pyx_t_38)) __PYX_ERR(0, 1049, __pyx_L1_error)
15648  __Pyx_GOTREF(__pyx_t_38);
15649  __Pyx_DECREF(__pyx_t_39); __pyx_t_39 = 0;
15650  __pyx_t_39 = __pyx_memoryview_fromslice(__pyx_v_W, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_39)) __PYX_ERR(0, 1049, __pyx_L1_error)
15651  __Pyx_GOTREF(__pyx_t_39);
15652  __pyx_t_40 = NULL;
15653  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_38))) {
15654  __pyx_t_40 = PyMethod_GET_SELF(__pyx_t_38);
15655  if (likely(__pyx_t_40)) {
15656  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_38);
15657  __Pyx_INCREF(__pyx_t_40);
15658  __Pyx_INCREF(function);
15659  __Pyx_DECREF_SET(__pyx_t_38, function);
15660  }
15661  }
15662  __pyx_t_2 = (__pyx_t_40) ? __Pyx_PyObject_Call2Args(__pyx_t_38, __pyx_t_40, __pyx_t_39) : __Pyx_PyObject_CallOneArg(__pyx_t_38, __pyx_t_39);
15663  __Pyx_XDECREF(__pyx_t_40); __pyx_t_40 = 0;
15664  __Pyx_DECREF(__pyx_t_39); __pyx_t_39 = 0;
15665  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1049, __pyx_L1_error)
15666  __Pyx_GOTREF(__pyx_t_2);
15667  __Pyx_DECREF(__pyx_t_38); __pyx_t_38 = 0;
15668  __pyx_t_38 = NULL;
15669  __pyx_t_14 = 0;
15670  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
15671  __pyx_t_38 = PyMethod_GET_SELF(__pyx_t_5);
15672  if (likely(__pyx_t_38)) {
15673  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
15674  __Pyx_INCREF(__pyx_t_38);
15675  __Pyx_INCREF(function);
15676  __Pyx_DECREF_SET(__pyx_t_5, function);
15677  __pyx_t_14 = 1;
15678  }
15679  }
15680  #if CYTHON_FAST_PYCALL
15681  if (PyFunction_Check(__pyx_t_5)) {
15682  PyObject *__pyx_temp[3] = {__pyx_t_38, __pyx_t_4, __pyx_t_2};
15683  __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1049, __pyx_L1_error)
15684  __Pyx_XDECREF(__pyx_t_38); __pyx_t_38 = 0;
15685  __Pyx_GOTREF(__pyx_t_1);
15686  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15687  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15688  } else
15689  #endif
15690  #if CYTHON_FAST_PYCCALL
15691  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
15692  PyObject *__pyx_temp[3] = {__pyx_t_38, __pyx_t_4, __pyx_t_2};
15693  __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1049, __pyx_L1_error)
15694  __Pyx_XDECREF(__pyx_t_38); __pyx_t_38 = 0;
15695  __Pyx_GOTREF(__pyx_t_1);
15696  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15697  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15698  } else
15699  #endif
15700  {
15701  __pyx_t_39 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_39)) __PYX_ERR(0, 1049, __pyx_L1_error)
15702  __Pyx_GOTREF(__pyx_t_39);
15703  if (__pyx_t_38) {
15704  __Pyx_GIVEREF(__pyx_t_38); PyTuple_SET_ITEM(__pyx_t_39, 0, __pyx_t_38); __pyx_t_38 = NULL;
15705  }
15706  __Pyx_GIVEREF(__pyx_t_4);
15707  PyTuple_SET_ITEM(__pyx_t_39, 0+__pyx_t_14, __pyx_t_4);
15708  __Pyx_GIVEREF(__pyx_t_2);
15709  PyTuple_SET_ITEM(__pyx_t_39, 1+__pyx_t_14, __pyx_t_2);
15710  __pyx_t_4 = 0;
15711  __pyx_t_2 = 0;
15712  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_39, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1049, __pyx_L1_error)
15713  __Pyx_GOTREF(__pyx_t_1);
15714  __Pyx_DECREF(__pyx_t_39); __pyx_t_39 = 0;
15715  }
15716  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
15717  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1049, __pyx_L1_error)
15718  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15719  __PYX_XDEC_MEMVIEW(&__pyx_v_AW, 1);
15720  __pyx_v_AW = __pyx_t_6;
15721  __pyx_t_6.memview = NULL;
15722  __pyx_t_6.data = NULL;
15723 
15724  /* "mprans/MeshSmoothing.pyx":1050
15725  * A[1,1] = vec_c[1]-vec_a[1]
15726  * AW = np.dot(A, np.linalg.inv(W))
15727  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0])) # <<<<<<<<<<<<<<
15728  * IMRElementsArray_[eN] += IMR
15729  * IMRElementsArray_[eN] = IMRElementsArray_[eN]/3.
15730  */
15731  __pyx_t_41 = 0;
15732  __pyx_t_42 = 0;
15733  if (__pyx_t_41 < 0) __pyx_t_41 += __pyx_v_AW.shape[0];
15734  if (__pyx_t_42 < 0) __pyx_t_42 += __pyx_v_AW.shape[1];
15735  __pyx_t_43 = 0;
15736  __pyx_t_44 = 1;
15737  if (__pyx_t_43 < 0) __pyx_t_43 += __pyx_v_AW.shape[0];
15738  if (__pyx_t_44 < 0) __pyx_t_44 += __pyx_v_AW.shape[1];
15739  __pyx_t_45 = 1;
15740  __pyx_t_46 = 0;
15741  if (__pyx_t_45 < 0) __pyx_t_45 += __pyx_v_AW.shape[0];
15742  if (__pyx_t_46 < 0) __pyx_t_46 += __pyx_v_AW.shape[1];
15743  __pyx_t_47 = 1;
15744  __pyx_t_48 = 1;
15745  if (__pyx_t_47 < 0) __pyx_t_47 += __pyx_v_AW.shape[0];
15746  if (__pyx_t_48 < 0) __pyx_t_48 += __pyx_v_AW.shape[1];
15747  __pyx_t_49 = 0;
15748  __pyx_t_50 = 0;
15749  if (__pyx_t_49 < 0) __pyx_t_49 += __pyx_v_AW.shape[0];
15750  if (__pyx_t_50 < 0) __pyx_t_50 += __pyx_v_AW.shape[1];
15751  __pyx_t_51 = 1;
15752  __pyx_t_52 = 1;
15753  if (__pyx_t_51 < 0) __pyx_t_51 += __pyx_v_AW.shape[0];
15754  if (__pyx_t_52 < 0) __pyx_t_52 += __pyx_v_AW.shape[1];
15755  __pyx_t_53 = 0;
15756  __pyx_t_54 = 1;
15757  if (__pyx_t_53 < 0) __pyx_t_53 += __pyx_v_AW.shape[0];
15758  if (__pyx_t_54 < 0) __pyx_t_54 += __pyx_v_AW.shape[1];
15759  __pyx_t_55 = 1;
15760  __pyx_t_56 = 0;
15761  if (__pyx_t_55 < 0) __pyx_t_55 += __pyx_v_AW.shape[0];
15762  if (__pyx_t_56 < 0) __pyx_t_56 += __pyx_v_AW.shape[1];
15763  __pyx_v_IMR = ((((pow((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_41 * __pyx_v_AW.strides[0]) ) + __pyx_t_42 * __pyx_v_AW.strides[1]) ))), 2.0) + pow((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_43 * __pyx_v_AW.strides[0]) ) + __pyx_t_44 * __pyx_v_AW.strides[1]) ))), 2.0)) + pow((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_45 * __pyx_v_AW.strides[0]) ) + __pyx_t_46 * __pyx_v_AW.strides[1]) ))), 2.0)) + pow((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_47 * __pyx_v_AW.strides[0]) ) + __pyx_t_48 * __pyx_v_AW.strides[1]) ))), 2.0)) / (2.0 * fabs((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_49 * __pyx_v_AW.strides[0]) ) + __pyx_t_50 * __pyx_v_AW.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_51 * __pyx_v_AW.strides[0]) ) + __pyx_t_52 * __pyx_v_AW.strides[1]) )))) - ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_53 * __pyx_v_AW.strides[0]) ) + __pyx_t_54 * __pyx_v_AW.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_55 * __pyx_v_AW.strides[0]) ) + __pyx_t_56 * __pyx_v_AW.strides[1]) ))))))));
15764 
15765  /* "mprans/MeshSmoothing.pyx":1051
15766  * AW = np.dot(A, np.linalg.inv(W))
15767  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0]))
15768  * IMRElementsArray_[eN] += IMR # <<<<<<<<<<<<<<
15769  * IMRElementsArray_[eN] = IMRElementsArray_[eN]/3.
15770  *
15771  */
15772  __pyx_t_57 = __pyx_v_eN;
15773  if (__pyx_t_57 < 0) __pyx_t_57 += __pyx_v_IMRElementsArray_.shape[0];
15774  *((double *) ( /* dim=0 */ (__pyx_v_IMRElementsArray_.data + __pyx_t_57 * __pyx_v_IMRElementsArray_.strides[0]) )) += __pyx_v_IMR;
15775 
15776  /* "mprans/MeshSmoothing.pyx":1041
15777  * cdef int node
15778  * for eN in range(nElements):
15779  * for iN, node in enumerate(elementNodesArray[eN]): # <<<<<<<<<<<<<<
15780  * vec_a = nodeArray[elementNodesArray[eN, iN]]
15781  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
15782  */
15783  }
15784  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15785 
15786  /* "mprans/MeshSmoothing.pyx":1052
15787  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0]))
15788  * IMRElementsArray_[eN] += IMR
15789  * IMRElementsArray_[eN] = IMRElementsArray_[eN]/3. # <<<<<<<<<<<<<<
15790  *
15791  * cdef double cyGetInverseMeanRatioSingleTriangle(int node0,
15792  */
15793  __pyx_t_58 = __pyx_v_eN;
15794  if (__pyx_t_58 < 0) __pyx_t_58 += __pyx_v_IMRElementsArray_.shape[0];
15795  __pyx_t_59 = __pyx_v_eN;
15796  if (__pyx_t_59 < 0) __pyx_t_59 += __pyx_v_IMRElementsArray_.shape[0];
15797  *((double *) ( /* dim=0 */ (__pyx_v_IMRElementsArray_.data + __pyx_t_59 * __pyx_v_IMRElementsArray_.strides[0]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_IMRElementsArray_.data + __pyx_t_58 * __pyx_v_IMRElementsArray_.strides[0]) ))) / 3.);
15798  }
15799 
15800  /* "mprans/MeshSmoothing.pyx":1024
15801  * IMRNodesArray_[node] = IMRNodesArray_[node]/nEl
15802  *
15803  * cdef void cyUpdateInverseMeanRatioTriangleElements(double[:] IMRElementsArray_, # <<<<<<<<<<<<<<
15804  * double[:,:] nodeArray,
15805  * int[:,:] elementNodesArray,
15806  */
15807 
15808  /* function exit code */
15809  goto __pyx_L0;
15810  __pyx_L1_error:;
15811  __Pyx_XDECREF(__pyx_t_1);
15812  __Pyx_XDECREF(__pyx_t_2);
15813  __Pyx_XDECREF(__pyx_t_3);
15814  __Pyx_XDECREF(__pyx_t_4);
15815  __Pyx_XDECREF(__pyx_t_5);
15816  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
15817  __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
15818  __PYX_XDEC_MEMVIEW(&__pyx_t_17, 1);
15819  __Pyx_XDECREF(__pyx_t_38);
15820  __Pyx_XDECREF(__pyx_t_39);
15821  __Pyx_XDECREF(__pyx_t_40);
15822  __Pyx_WriteUnraisable("mprans.MeshSmoothing.cyUpdateInverseMeanRatioTriangleElements", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
15823  __pyx_L0:;
15824  __PYX_XDEC_MEMVIEW(&__pyx_v_W, 1);
15825  __PYX_XDEC_MEMVIEW(&__pyx_v_A, 1);
15826  __PYX_XDEC_MEMVIEW(&__pyx_v_AW, 1);
15827  __PYX_XDEC_MEMVIEW(&__pyx_v_vec_a, 1);
15828  __PYX_XDEC_MEMVIEW(&__pyx_v_vec_b, 1);
15829  __PYX_XDEC_MEMVIEW(&__pyx_v_vec_c, 1);
15830  __Pyx_RefNannyFinishContext();
15831 }
15832 
15833 /* "mprans/MeshSmoothing.pyx":1054
15834  * IMRElementsArray_[eN] = IMRElementsArray_[eN]/3.
15835  *
15836  * cdef double cyGetInverseMeanRatioSingleTriangle(int node0, # <<<<<<<<<<<<<<
15837  * double[:,:] nodeArray,
15838  * int[:,:] elementNodesArray,
15839  */
15840 
15841 static double __pyx_f_6mprans_13MeshSmoothing_cyGetInverseMeanRatioSingleTriangle(int __pyx_v_node0, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementNodesArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_nodeElementsArray, struct __pyx_opt_args_6mprans_13MeshSmoothing_cyGetInverseMeanRatioSingleTriangle *__pyx_optional_args) {
15842 
15843  /* "mprans/MeshSmoothing.pyx":1059
15844  * int[:] nodeElementOffsets,
15845  * int[:] nodeElementsArray,
15846  * bool el_average=False): # <<<<<<<<<<<<<<
15847  * cdef double[:,:] W = np.array([[1., 0.5],
15848  * [0., sqrt(3)/2.]])
15849  */
15850  bool __pyx_v_el_average = ((bool)0);
15851  __Pyx_memviewslice __pyx_v_W = { 0, 0, { 0 }, { 0 }, { 0 } };
15852  __Pyx_memviewslice __pyx_v_A = { 0, 0, { 0 }, { 0 }, { 0 } };
15853  __Pyx_memviewslice __pyx_v_AW = { 0, 0, { 0 }, { 0 }, { 0 } };
15854  double __pyx_v_IMR_node;
15855  int __pyx_v_nEl;
15856  __Pyx_memviewslice __pyx_v_vec_a = { 0, 0, { 0 }, { 0 }, { 0 } };
15857  __Pyx_memviewslice __pyx_v_vec_b = { 0, 0, { 0 }, { 0 }, { 0 } };
15858  __Pyx_memviewslice __pyx_v_vec_c = { 0, 0, { 0 }, { 0 }, { 0 } };
15859  double __pyx_v_IMR;
15860  int __pyx_v_eOffset;
15861  int __pyx_v_iN;
15862  int __pyx_v_node;
15863  int __pyx_v_eN;
15864  int __pyx_v_nNel;
15865  double __pyx_r;
15866  __Pyx_RefNannyDeclarations
15867  PyObject *__pyx_t_1 = NULL;
15868  PyObject *__pyx_t_2 = NULL;
15869  PyObject *__pyx_t_3 = NULL;
15870  PyObject *__pyx_t_4 = NULL;
15871  PyObject *__pyx_t_5 = NULL;
15872  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
15873  Py_ssize_t __pyx_t_7;
15874  int __pyx_t_8;
15875  Py_ssize_t __pyx_t_9;
15876  int __pyx_t_10;
15877  int __pyx_t_11;
15878  Py_ssize_t __pyx_t_12;
15879  int __pyx_t_13;
15880  int __pyx_t_14;
15881  int __pyx_t_15;
15882  Py_ssize_t __pyx_t_16;
15883  Py_ssize_t __pyx_t_17;
15884  int __pyx_t_18;
15885  Py_ssize_t __pyx_t_19;
15886  Py_ssize_t __pyx_t_20;
15887  __Pyx_memviewslice __pyx_t_21 = { 0, 0, { 0 }, { 0 }, { 0 } };
15888  Py_ssize_t __pyx_t_22;
15889  Py_ssize_t __pyx_t_23;
15890  Py_ssize_t __pyx_t_24;
15891  Py_ssize_t __pyx_t_25;
15892  Py_ssize_t __pyx_t_26;
15893  Py_ssize_t __pyx_t_27;
15894  Py_ssize_t __pyx_t_28;
15895  Py_ssize_t __pyx_t_29;
15896  Py_ssize_t __pyx_t_30;
15897  Py_ssize_t __pyx_t_31;
15898  Py_ssize_t __pyx_t_32;
15899  Py_ssize_t __pyx_t_33;
15900  Py_ssize_t __pyx_t_34;
15901  Py_ssize_t __pyx_t_35;
15902  Py_ssize_t __pyx_t_36;
15903  Py_ssize_t __pyx_t_37;
15904  Py_ssize_t __pyx_t_38;
15905  Py_ssize_t __pyx_t_39;
15906  Py_ssize_t __pyx_t_40;
15907  Py_ssize_t __pyx_t_41;
15908  PyObject *__pyx_t_42 = NULL;
15909  PyObject *__pyx_t_43 = NULL;
15910  int __pyx_t_44;
15911  Py_ssize_t __pyx_t_45;
15912  Py_ssize_t __pyx_t_46;
15913  Py_ssize_t __pyx_t_47;
15914  Py_ssize_t __pyx_t_48;
15915  Py_ssize_t __pyx_t_49;
15916  Py_ssize_t __pyx_t_50;
15917  Py_ssize_t __pyx_t_51;
15918  Py_ssize_t __pyx_t_52;
15919  Py_ssize_t __pyx_t_53;
15920  Py_ssize_t __pyx_t_54;
15921  Py_ssize_t __pyx_t_55;
15922  Py_ssize_t __pyx_t_56;
15923  Py_ssize_t __pyx_t_57;
15924  Py_ssize_t __pyx_t_58;
15925  Py_ssize_t __pyx_t_59;
15926  Py_ssize_t __pyx_t_60;
15927  Py_ssize_t __pyx_t_61;
15928  Py_ssize_t __pyx_t_62;
15929  Py_ssize_t __pyx_t_63;
15930  Py_ssize_t __pyx_t_64;
15931  Py_ssize_t __pyx_t_65;
15932  Py_ssize_t __pyx_t_66;
15933  Py_ssize_t __pyx_t_67;
15934  Py_ssize_t __pyx_t_68;
15935  Py_ssize_t __pyx_t_69;
15936  Py_ssize_t __pyx_t_70;
15937  Py_ssize_t __pyx_t_71;
15938  Py_ssize_t __pyx_t_72;
15939  Py_ssize_t __pyx_t_73;
15940  Py_ssize_t __pyx_t_74;
15941  Py_ssize_t __pyx_t_75;
15942  Py_ssize_t __pyx_t_76;
15943  Py_ssize_t __pyx_t_77;
15944  Py_ssize_t __pyx_t_78;
15945  Py_ssize_t __pyx_t_79;
15946  Py_ssize_t __pyx_t_80;
15947  Py_ssize_t __pyx_t_81;
15948  Py_ssize_t __pyx_t_82;
15949  Py_ssize_t __pyx_t_83;
15950  Py_ssize_t __pyx_t_84;
15951  Py_ssize_t __pyx_t_85;
15952  Py_ssize_t __pyx_t_86;
15953  Py_ssize_t __pyx_t_87;
15954  Py_ssize_t __pyx_t_88;
15955  Py_ssize_t __pyx_t_89;
15956  Py_ssize_t __pyx_t_90;
15957  Py_ssize_t __pyx_t_91;
15958  Py_ssize_t __pyx_t_92;
15959  Py_ssize_t __pyx_t_93;
15960  Py_ssize_t __pyx_t_94;
15961  Py_ssize_t __pyx_t_95;
15962  Py_ssize_t __pyx_t_96;
15963  Py_ssize_t __pyx_t_97;
15964  Py_ssize_t __pyx_t_98;
15965  __Pyx_RefNannySetupContext("cyGetInverseMeanRatioSingleTriangle", 0);
15966  if (__pyx_optional_args) {
15967  if (__pyx_optional_args->__pyx_n > 0) {
15968  __pyx_v_el_average = __pyx_optional_args->el_average;
15969  }
15970  }
15971 
15972  /* "mprans/MeshSmoothing.pyx":1060
15973  * int[:] nodeElementsArray,
15974  * bool el_average=False):
15975  * cdef double[:,:] W = np.array([[1., 0.5], # <<<<<<<<<<<<<<
15976  * [0., sqrt(3)/2.]])
15977  * cdef double[:,:] A = np.zeros((2,2))
15978  */
15979  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1060, __pyx_L1_error)
15980  __Pyx_GOTREF(__pyx_t_2);
15981  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1060, __pyx_L1_error)
15982  __Pyx_GOTREF(__pyx_t_3);
15983  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15984  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1060, __pyx_L1_error)
15985  __Pyx_GOTREF(__pyx_t_2);
15986  __Pyx_INCREF(__pyx_float_1_);
15987  __Pyx_GIVEREF(__pyx_float_1_);
15988  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_float_1_);
15989  __Pyx_INCREF(__pyx_float_0_5);
15990  __Pyx_GIVEREF(__pyx_float_0_5);
15991  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_float_0_5);
15992 
15993  /* "mprans/MeshSmoothing.pyx":1061
15994  * bool el_average=False):
15995  * cdef double[:,:] W = np.array([[1., 0.5],
15996  * [0., sqrt(3)/2.]]) # <<<<<<<<<<<<<<
15997  * cdef double[:,:] A = np.zeros((2,2))
15998  * cdef double[:,:] AW = np.zeros((2,2))
15999  */
16000  __pyx_t_4 = PyFloat_FromDouble((sqrt(3.0) / 2.)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1061, __pyx_L1_error)
16001  __Pyx_GOTREF(__pyx_t_4);
16002  __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1061, __pyx_L1_error)
16003  __Pyx_GOTREF(__pyx_t_5);
16004  __Pyx_INCREF(__pyx_float_0_);
16005  __Pyx_GIVEREF(__pyx_float_0_);
16006  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_float_0_);
16007  __Pyx_GIVEREF(__pyx_t_4);
16008  PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
16009  __pyx_t_4 = 0;
16010 
16011  /* "mprans/MeshSmoothing.pyx":1060
16012  * int[:] nodeElementsArray,
16013  * bool el_average=False):
16014  * cdef double[:,:] W = np.array([[1., 0.5], # <<<<<<<<<<<<<<
16015  * [0., sqrt(3)/2.]])
16016  * cdef double[:,:] A = np.zeros((2,2))
16017  */
16018  __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1060, __pyx_L1_error)
16019  __Pyx_GOTREF(__pyx_t_4);
16020  __Pyx_GIVEREF(__pyx_t_2);
16021  PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
16022  __Pyx_GIVEREF(__pyx_t_5);
16023  PyList_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
16024  __pyx_t_2 = 0;
16025  __pyx_t_5 = 0;
16026  __pyx_t_5 = NULL;
16027  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
16028  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
16029  if (likely(__pyx_t_5)) {
16030  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
16031  __Pyx_INCREF(__pyx_t_5);
16032  __Pyx_INCREF(function);
16033  __Pyx_DECREF_SET(__pyx_t_3, function);
16034  }
16035  }
16036  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
16037  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
16038  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16039  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1060, __pyx_L1_error)
16040  __Pyx_GOTREF(__pyx_t_1);
16041  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16042  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1060, __pyx_L1_error)
16043  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16044  __pyx_v_W = __pyx_t_6;
16045  __pyx_t_6.memview = NULL;
16046  __pyx_t_6.data = NULL;
16047 
16048  /* "mprans/MeshSmoothing.pyx":1062
16049  * cdef double[:,:] W = np.array([[1., 0.5],
16050  * [0., sqrt(3)/2.]])
16051  * cdef double[:,:] A = np.zeros((2,2)) # <<<<<<<<<<<<<<
16052  * cdef double[:,:] AW = np.zeros((2,2))
16053  * cdef double IMR_node = 0.
16054  */
16055  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1062, __pyx_L1_error)
16056  __Pyx_GOTREF(__pyx_t_3);
16057  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1062, __pyx_L1_error)
16058  __Pyx_GOTREF(__pyx_t_4);
16059  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16060  __pyx_t_3 = NULL;
16061  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
16062  __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
16063  if (likely(__pyx_t_3)) {
16064  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
16065  __Pyx_INCREF(__pyx_t_3);
16066  __Pyx_INCREF(function);
16067  __Pyx_DECREF_SET(__pyx_t_4, function);
16068  }
16069  }
16070  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_tuple__6) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_tuple__6);
16071  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
16072  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1062, __pyx_L1_error)
16073  __Pyx_GOTREF(__pyx_t_1);
16074  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16075  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1062, __pyx_L1_error)
16076  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16077  __pyx_v_A = __pyx_t_6;
16078  __pyx_t_6.memview = NULL;
16079  __pyx_t_6.data = NULL;
16080 
16081  /* "mprans/MeshSmoothing.pyx":1063
16082  * [0., sqrt(3)/2.]])
16083  * cdef double[:,:] A = np.zeros((2,2))
16084  * cdef double[:,:] AW = np.zeros((2,2)) # <<<<<<<<<<<<<<
16085  * cdef double IMR_node = 0.
16086  * cdef int nEl = 0
16087  */
16088  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1063, __pyx_L1_error)
16089  __Pyx_GOTREF(__pyx_t_4);
16090  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1063, __pyx_L1_error)
16091  __Pyx_GOTREF(__pyx_t_3);
16092  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16093  __pyx_t_4 = NULL;
16094  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
16095  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
16096  if (likely(__pyx_t_4)) {
16097  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
16098  __Pyx_INCREF(__pyx_t_4);
16099  __Pyx_INCREF(function);
16100  __Pyx_DECREF_SET(__pyx_t_3, function);
16101  }
16102  }
16103  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_tuple__6) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_tuple__6);
16104  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
16105  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1063, __pyx_L1_error)
16106  __Pyx_GOTREF(__pyx_t_1);
16107  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16108  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1063, __pyx_L1_error)
16109  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16110  __pyx_v_AW = __pyx_t_6;
16111  __pyx_t_6.memview = NULL;
16112  __pyx_t_6.data = NULL;
16113 
16114  /* "mprans/MeshSmoothing.pyx":1064
16115  * cdef double[:,:] A = np.zeros((2,2))
16116  * cdef double[:,:] AW = np.zeros((2,2))
16117  * cdef double IMR_node = 0. # <<<<<<<<<<<<<<
16118  * cdef int nEl = 0
16119  * cdef double[:] vec_a
16120  */
16121  __pyx_v_IMR_node = 0.;
16122 
16123  /* "mprans/MeshSmoothing.pyx":1065
16124  * cdef double[:,:] AW = np.zeros((2,2))
16125  * cdef double IMR_node = 0.
16126  * cdef int nEl = 0 # <<<<<<<<<<<<<<
16127  * cdef double[:] vec_a
16128  * cdef double[:] vec_b
16129  */
16130  __pyx_v_nEl = 0;
16131 
16132  /* "mprans/MeshSmoothing.pyx":1074
16133  * cdef int node
16134  * cdef int eN
16135  * cdef int nNel = elementNodesArray.shape[1] # <<<<<<<<<<<<<<
16136  * for eOffset in range(nodeElementOffsets[node0],
16137  * nodeElementOffsets[node0+1]):
16138  */
16139  __pyx_v_nNel = (__pyx_v_elementNodesArray.shape[1]);
16140 
16141  /* "mprans/MeshSmoothing.pyx":1076
16142  * cdef int nNel = elementNodesArray.shape[1]
16143  * for eOffset in range(nodeElementOffsets[node0],
16144  * nodeElementOffsets[node0+1]): # <<<<<<<<<<<<<<
16145  * eN = nodeElementsArray[eOffset]
16146  * nEl += 1
16147  */
16148  __pyx_t_7 = (__pyx_v_node0 + 1);
16149  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_nodeElementOffsets.shape[0];
16150  __pyx_t_8 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_7 * __pyx_v_nodeElementOffsets.strides[0]) )));
16151 
16152  /* "mprans/MeshSmoothing.pyx":1075
16153  * cdef int eN
16154  * cdef int nNel = elementNodesArray.shape[1]
16155  * for eOffset in range(nodeElementOffsets[node0], # <<<<<<<<<<<<<<
16156  * nodeElementOffsets[node0+1]):
16157  * eN = nodeElementsArray[eOffset]
16158  */
16159  __pyx_t_9 = __pyx_v_node0;
16160  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_nodeElementOffsets.shape[0];
16161 
16162  /* "mprans/MeshSmoothing.pyx":1076
16163  * cdef int nNel = elementNodesArray.shape[1]
16164  * for eOffset in range(nodeElementOffsets[node0],
16165  * nodeElementOffsets[node0+1]): # <<<<<<<<<<<<<<
16166  * eN = nodeElementsArray[eOffset]
16167  * nEl += 1
16168  */
16169  __pyx_t_10 = __pyx_t_8;
16170  for (__pyx_t_11 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_9 * __pyx_v_nodeElementOffsets.strides[0]) ))); __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
16171 
16172  /* "mprans/MeshSmoothing.pyx":1075
16173  * cdef int eN
16174  * cdef int nNel = elementNodesArray.shape[1]
16175  * for eOffset in range(nodeElementOffsets[node0], # <<<<<<<<<<<<<<
16176  * nodeElementOffsets[node0+1]):
16177  * eN = nodeElementsArray[eOffset]
16178  */
16179  __pyx_v_eOffset = __pyx_t_11;
16180 
16181  /* "mprans/MeshSmoothing.pyx":1077
16182  * for eOffset in range(nodeElementOffsets[node0],
16183  * nodeElementOffsets[node0+1]):
16184  * eN = nodeElementsArray[eOffset] # <<<<<<<<<<<<<<
16185  * nEl += 1
16186  * ################
16187  */
16188  __pyx_t_12 = __pyx_v_eOffset;
16189  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_nodeElementsArray.shape[0];
16190  __pyx_v_eN = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementsArray.data + __pyx_t_12 * __pyx_v_nodeElementsArray.strides[0]) )));
16191 
16192  /* "mprans/MeshSmoothing.pyx":1078
16193  * nodeElementOffsets[node0+1]):
16194  * eN = nodeElementsArray[eOffset]
16195  * nEl += 1 # <<<<<<<<<<<<<<
16196  * ################
16197  * for iN in range(nNel):
16198  */
16199  __pyx_v_nEl = (__pyx_v_nEl + 1);
16200 
16201  /* "mprans/MeshSmoothing.pyx":1080
16202  * nEl += 1
16203  * ################
16204  * for iN in range(nNel): # <<<<<<<<<<<<<<
16205  * node = elementNodesArray[eN, iN]
16206  * if el_average:
16207  */
16208  __pyx_t_13 = __pyx_v_nNel;
16209  __pyx_t_14 = __pyx_t_13;
16210  for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
16211  __pyx_v_iN = __pyx_t_15;
16212 
16213  /* "mprans/MeshSmoothing.pyx":1081
16214  * ################
16215  * for iN in range(nNel):
16216  * node = elementNodesArray[eN, iN] # <<<<<<<<<<<<<<
16217  * if el_average:
16218  * vec_a = nodeArray[elementNodesArray[eN, iN]]
16219  */
16220  __pyx_t_16 = __pyx_v_eN;
16221  __pyx_t_17 = __pyx_v_iN;
16222  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_elementNodesArray.shape[0];
16223  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_elementNodesArray.shape[1];
16224  __pyx_v_node = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_16 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_17 * __pyx_v_elementNodesArray.strides[1]) )));
16225 
16226  /* "mprans/MeshSmoothing.pyx":1082
16227  * for iN in range(nNel):
16228  * node = elementNodesArray[eN, iN]
16229  * if el_average: # <<<<<<<<<<<<<<
16230  * vec_a = nodeArray[elementNodesArray[eN, iN]]
16231  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
16232  */
16233  __pyx_t_18 = (__pyx_v_el_average != 0);
16234  if (__pyx_t_18) {
16235 
16236  /* "mprans/MeshSmoothing.pyx":1083
16237  * node = elementNodesArray[eN, iN]
16238  * if el_average:
16239  * vec_a = nodeArray[elementNodesArray[eN, iN]] # <<<<<<<<<<<<<<
16240  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
16241  * vec_c = nodeArray[elementNodesArray[eN, iN-2]]
16242  */
16243  __pyx_t_19 = __pyx_v_eN;
16244  __pyx_t_20 = __pyx_v_iN;
16245  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_elementNodesArray.shape[0];
16246  if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_elementNodesArray.shape[1];
16247  __pyx_t_21.data = __pyx_v_nodeArray.data;
16248  __pyx_t_21.memview = __pyx_v_nodeArray.memview;
16249  __PYX_INC_MEMVIEW(&__pyx_t_21, 0);
16250  {
16251  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_19 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_20 * __pyx_v_elementNodesArray.strides[1]) )));
16252  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
16253  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
16254  if (__pyx_tmp_idx < 0)
16255  __pyx_tmp_idx += __pyx_tmp_shape;
16256  if ((0)) __PYX_ERR(0, 1083, __pyx_L1_error)
16257  __pyx_t_21.data += __pyx_tmp_idx * __pyx_tmp_stride;
16258 }
16259 
16260 __pyx_t_21.shape[0] = __pyx_v_nodeArray.shape[1];
16261 __pyx_t_21.strides[0] = __pyx_v_nodeArray.strides[1];
16262  __pyx_t_21.suboffsets[0] = -1;
16263 
16264 __PYX_XDEC_MEMVIEW(&__pyx_v_vec_a, 1);
16265  __pyx_v_vec_a = __pyx_t_21;
16266  __pyx_t_21.memview = NULL;
16267  __pyx_t_21.data = NULL;
16268 
16269  /* "mprans/MeshSmoothing.pyx":1084
16270  * if el_average:
16271  * vec_a = nodeArray[elementNodesArray[eN, iN]]
16272  * vec_b = nodeArray[elementNodesArray[eN, iN-1]] # <<<<<<<<<<<<<<
16273  * vec_c = nodeArray[elementNodesArray[eN, iN-2]]
16274  * A[0,0] = vec_b[0]-vec_a[0]
16275  */
16276  __pyx_t_22 = __pyx_v_eN;
16277  __pyx_t_23 = (__pyx_v_iN - 1);
16278  if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_elementNodesArray.shape[0];
16279  if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_elementNodesArray.shape[1];
16280  __pyx_t_21.data = __pyx_v_nodeArray.data;
16281  __pyx_t_21.memview = __pyx_v_nodeArray.memview;
16282  __PYX_INC_MEMVIEW(&__pyx_t_21, 0);
16283  {
16284  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_22 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_23 * __pyx_v_elementNodesArray.strides[1]) )));
16285  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
16286  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
16287  if (__pyx_tmp_idx < 0)
16288  __pyx_tmp_idx += __pyx_tmp_shape;
16289  if ((0)) __PYX_ERR(0, 1084, __pyx_L1_error)
16290  __pyx_t_21.data += __pyx_tmp_idx * __pyx_tmp_stride;
16291 }
16292 
16293 __pyx_t_21.shape[0] = __pyx_v_nodeArray.shape[1];
16294 __pyx_t_21.strides[0] = __pyx_v_nodeArray.strides[1];
16295  __pyx_t_21.suboffsets[0] = -1;
16296 
16297 __PYX_XDEC_MEMVIEW(&__pyx_v_vec_b, 1);
16298  __pyx_v_vec_b = __pyx_t_21;
16299  __pyx_t_21.memview = NULL;
16300  __pyx_t_21.data = NULL;
16301 
16302  /* "mprans/MeshSmoothing.pyx":1085
16303  * vec_a = nodeArray[elementNodesArray[eN, iN]]
16304  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
16305  * vec_c = nodeArray[elementNodesArray[eN, iN-2]] # <<<<<<<<<<<<<<
16306  * A[0,0] = vec_b[0]-vec_a[0]
16307  * A[1,0] = vec_b[1]-vec_a[1]
16308  */
16309  __pyx_t_24 = __pyx_v_eN;
16310  __pyx_t_25 = (__pyx_v_iN - 2);
16311  if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_elementNodesArray.shape[0];
16312  if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_elementNodesArray.shape[1];
16313  __pyx_t_21.data = __pyx_v_nodeArray.data;
16314  __pyx_t_21.memview = __pyx_v_nodeArray.memview;
16315  __PYX_INC_MEMVIEW(&__pyx_t_21, 0);
16316  {
16317  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_24 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_25 * __pyx_v_elementNodesArray.strides[1]) )));
16318  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
16319  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
16320  if (__pyx_tmp_idx < 0)
16321  __pyx_tmp_idx += __pyx_tmp_shape;
16322  if ((0)) __PYX_ERR(0, 1085, __pyx_L1_error)
16323  __pyx_t_21.data += __pyx_tmp_idx * __pyx_tmp_stride;
16324 }
16325 
16326 __pyx_t_21.shape[0] = __pyx_v_nodeArray.shape[1];
16327 __pyx_t_21.strides[0] = __pyx_v_nodeArray.strides[1];
16328  __pyx_t_21.suboffsets[0] = -1;
16329 
16330 __PYX_XDEC_MEMVIEW(&__pyx_v_vec_c, 1);
16331  __pyx_v_vec_c = __pyx_t_21;
16332  __pyx_t_21.memview = NULL;
16333  __pyx_t_21.data = NULL;
16334 
16335  /* "mprans/MeshSmoothing.pyx":1086
16336  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
16337  * vec_c = nodeArray[elementNodesArray[eN, iN-2]]
16338  * A[0,0] = vec_b[0]-vec_a[0] # <<<<<<<<<<<<<<
16339  * A[1,0] = vec_b[1]-vec_a[1]
16340  * A[0,1] = vec_c[0]-vec_a[0]
16341  */
16342  __pyx_t_26 = 0;
16343  if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_vec_b.shape[0];
16344  __pyx_t_27 = 0;
16345  if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_vec_a.shape[0];
16346  __pyx_t_28 = 0;
16347  __pyx_t_29 = 0;
16348  if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_A.shape[0];
16349  if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_A.shape[1];
16350  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_A.data + __pyx_t_28 * __pyx_v_A.strides[0]) ) + __pyx_t_29 * __pyx_v_A.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vec_b.data + __pyx_t_26 * __pyx_v_vec_b.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_vec_a.data + __pyx_t_27 * __pyx_v_vec_a.strides[0]) ))));
16351 
16352  /* "mprans/MeshSmoothing.pyx":1087
16353  * vec_c = nodeArray[elementNodesArray[eN, iN-2]]
16354  * A[0,0] = vec_b[0]-vec_a[0]
16355  * A[1,0] = vec_b[1]-vec_a[1] # <<<<<<<<<<<<<<
16356  * A[0,1] = vec_c[0]-vec_a[0]
16357  * A[1,1] = vec_c[1]-vec_a[1]
16358  */
16359  __pyx_t_30 = 1;
16360  if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_vec_b.shape[0];
16361  __pyx_t_31 = 1;
16362  if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_vec_a.shape[0];
16363  __pyx_t_32 = 1;
16364  __pyx_t_33 = 0;
16365  if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_A.shape[0];
16366  if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_A.shape[1];
16367  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_A.data + __pyx_t_32 * __pyx_v_A.strides[0]) ) + __pyx_t_33 * __pyx_v_A.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vec_b.data + __pyx_t_30 * __pyx_v_vec_b.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_vec_a.data + __pyx_t_31 * __pyx_v_vec_a.strides[0]) ))));
16368 
16369  /* "mprans/MeshSmoothing.pyx":1088
16370  * A[0,0] = vec_b[0]-vec_a[0]
16371  * A[1,0] = vec_b[1]-vec_a[1]
16372  * A[0,1] = vec_c[0]-vec_a[0] # <<<<<<<<<<<<<<
16373  * A[1,1] = vec_c[1]-vec_a[1]
16374  * AW = np.dot(A, np.linalg.inv(W))
16375  */
16376  __pyx_t_34 = 0;
16377  if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_vec_c.shape[0];
16378  __pyx_t_35 = 0;
16379  if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_vec_a.shape[0];
16380  __pyx_t_36 = 0;
16381  __pyx_t_37 = 1;
16382  if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_A.shape[0];
16383  if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_A.shape[1];
16384  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_A.data + __pyx_t_36 * __pyx_v_A.strides[0]) ) + __pyx_t_37 * __pyx_v_A.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vec_c.data + __pyx_t_34 * __pyx_v_vec_c.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_vec_a.data + __pyx_t_35 * __pyx_v_vec_a.strides[0]) ))));
16385 
16386  /* "mprans/MeshSmoothing.pyx":1089
16387  * A[1,0] = vec_b[1]-vec_a[1]
16388  * A[0,1] = vec_c[0]-vec_a[0]
16389  * A[1,1] = vec_c[1]-vec_a[1] # <<<<<<<<<<<<<<
16390  * AW = np.dot(A, np.linalg.inv(W))
16391  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0]))
16392  */
16393  __pyx_t_38 = 1;
16394  if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_vec_c.shape[0];
16395  __pyx_t_39 = 1;
16396  if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_v_vec_a.shape[0];
16397  __pyx_t_40 = 1;
16398  __pyx_t_41 = 1;
16399  if (__pyx_t_40 < 0) __pyx_t_40 += __pyx_v_A.shape[0];
16400  if (__pyx_t_41 < 0) __pyx_t_41 += __pyx_v_A.shape[1];
16401  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_A.data + __pyx_t_40 * __pyx_v_A.strides[0]) ) + __pyx_t_41 * __pyx_v_A.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vec_c.data + __pyx_t_38 * __pyx_v_vec_c.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_vec_a.data + __pyx_t_39 * __pyx_v_vec_a.strides[0]) ))));
16402 
16403  /* "mprans/MeshSmoothing.pyx":1090
16404  * A[0,1] = vec_c[0]-vec_a[0]
16405  * A[1,1] = vec_c[1]-vec_a[1]
16406  * AW = np.dot(A, np.linalg.inv(W)) # <<<<<<<<<<<<<<
16407  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0]))
16408  * IMR_node += IMR/3. # /3. because 3 nodes in element
16409  */
16410  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1090, __pyx_L1_error)
16411  __Pyx_GOTREF(__pyx_t_3);
16412  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_dot); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1090, __pyx_L1_error)
16413  __Pyx_GOTREF(__pyx_t_4);
16414  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16415  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_A, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1090, __pyx_L1_error)
16416  __Pyx_GOTREF(__pyx_t_3);
16417  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1090, __pyx_L1_error)
16418  __Pyx_GOTREF(__pyx_t_2);
16419  __pyx_t_42 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_linalg); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 1090, __pyx_L1_error)
16420  __Pyx_GOTREF(__pyx_t_42);
16421  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16422  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_42, __pyx_n_s_inv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1090, __pyx_L1_error)
16423  __Pyx_GOTREF(__pyx_t_2);
16424  __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0;
16425  __pyx_t_42 = __pyx_memoryview_fromslice(__pyx_v_W, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 1090, __pyx_L1_error)
16426  __Pyx_GOTREF(__pyx_t_42);
16427  __pyx_t_43 = NULL;
16428  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
16429  __pyx_t_43 = PyMethod_GET_SELF(__pyx_t_2);
16430  if (likely(__pyx_t_43)) {
16431  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
16432  __Pyx_INCREF(__pyx_t_43);
16433  __Pyx_INCREF(function);
16434  __Pyx_DECREF_SET(__pyx_t_2, function);
16435  }
16436  }
16437  __pyx_t_5 = (__pyx_t_43) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_43, __pyx_t_42) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_42);
16438  __Pyx_XDECREF(__pyx_t_43); __pyx_t_43 = 0;
16439  __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0;
16440  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1090, __pyx_L1_error)
16441  __Pyx_GOTREF(__pyx_t_5);
16442  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16443  __pyx_t_2 = NULL;
16444  __pyx_t_44 = 0;
16445  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
16446  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
16447  if (likely(__pyx_t_2)) {
16448  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
16449  __Pyx_INCREF(__pyx_t_2);
16450  __Pyx_INCREF(function);
16451  __Pyx_DECREF_SET(__pyx_t_4, function);
16452  __pyx_t_44 = 1;
16453  }
16454  }
16455  #if CYTHON_FAST_PYCALL
16456  if (PyFunction_Check(__pyx_t_4)) {
16457  PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_3, __pyx_t_5};
16458  __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_44, 2+__pyx_t_44); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1090, __pyx_L1_error)
16459  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
16460  __Pyx_GOTREF(__pyx_t_1);
16461  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16462  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
16463  } else
16464  #endif
16465  #if CYTHON_FAST_PYCCALL
16466  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
16467  PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_3, __pyx_t_5};
16468  __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_44, 2+__pyx_t_44); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1090, __pyx_L1_error)
16469  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
16470  __Pyx_GOTREF(__pyx_t_1);
16471  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16472  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
16473  } else
16474  #endif
16475  {
16476  __pyx_t_42 = PyTuple_New(2+__pyx_t_44); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 1090, __pyx_L1_error)
16477  __Pyx_GOTREF(__pyx_t_42);
16478  if (__pyx_t_2) {
16479  __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_42, 0, __pyx_t_2); __pyx_t_2 = NULL;
16480  }
16481  __Pyx_GIVEREF(__pyx_t_3);
16482  PyTuple_SET_ITEM(__pyx_t_42, 0+__pyx_t_44, __pyx_t_3);
16483  __Pyx_GIVEREF(__pyx_t_5);
16484  PyTuple_SET_ITEM(__pyx_t_42, 1+__pyx_t_44, __pyx_t_5);
16485  __pyx_t_3 = 0;
16486  __pyx_t_5 = 0;
16487  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_42, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1090, __pyx_L1_error)
16488  __Pyx_GOTREF(__pyx_t_1);
16489  __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0;
16490  }
16491  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16492  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1090, __pyx_L1_error)
16493  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16494  __PYX_XDEC_MEMVIEW(&__pyx_v_AW, 1);
16495  __pyx_v_AW = __pyx_t_6;
16496  __pyx_t_6.memview = NULL;
16497  __pyx_t_6.data = NULL;
16498 
16499  /* "mprans/MeshSmoothing.pyx":1091
16500  * A[1,1] = vec_c[1]-vec_a[1]
16501  * AW = np.dot(A, np.linalg.inv(W))
16502  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0])) # <<<<<<<<<<<<<<
16503  * IMR_node += IMR/3. # /3. because 3 nodes in element
16504  * else:
16505  */
16506  __pyx_t_45 = 0;
16507  __pyx_t_46 = 0;
16508  if (__pyx_t_45 < 0) __pyx_t_45 += __pyx_v_AW.shape[0];
16509  if (__pyx_t_46 < 0) __pyx_t_46 += __pyx_v_AW.shape[1];
16510  __pyx_t_47 = 0;
16511  __pyx_t_48 = 1;
16512  if (__pyx_t_47 < 0) __pyx_t_47 += __pyx_v_AW.shape[0];
16513  if (__pyx_t_48 < 0) __pyx_t_48 += __pyx_v_AW.shape[1];
16514  __pyx_t_49 = 1;
16515  __pyx_t_50 = 0;
16516  if (__pyx_t_49 < 0) __pyx_t_49 += __pyx_v_AW.shape[0];
16517  if (__pyx_t_50 < 0) __pyx_t_50 += __pyx_v_AW.shape[1];
16518  __pyx_t_51 = 1;
16519  __pyx_t_52 = 1;
16520  if (__pyx_t_51 < 0) __pyx_t_51 += __pyx_v_AW.shape[0];
16521  if (__pyx_t_52 < 0) __pyx_t_52 += __pyx_v_AW.shape[1];
16522  __pyx_t_53 = 0;
16523  __pyx_t_54 = 0;
16524  if (__pyx_t_53 < 0) __pyx_t_53 += __pyx_v_AW.shape[0];
16525  if (__pyx_t_54 < 0) __pyx_t_54 += __pyx_v_AW.shape[1];
16526  __pyx_t_55 = 1;
16527  __pyx_t_56 = 1;
16528  if (__pyx_t_55 < 0) __pyx_t_55 += __pyx_v_AW.shape[0];
16529  if (__pyx_t_56 < 0) __pyx_t_56 += __pyx_v_AW.shape[1];
16530  __pyx_t_57 = 0;
16531  __pyx_t_58 = 1;
16532  if (__pyx_t_57 < 0) __pyx_t_57 += __pyx_v_AW.shape[0];
16533  if (__pyx_t_58 < 0) __pyx_t_58 += __pyx_v_AW.shape[1];
16534  __pyx_t_59 = 1;
16535  __pyx_t_60 = 0;
16536  if (__pyx_t_59 < 0) __pyx_t_59 += __pyx_v_AW.shape[0];
16537  if (__pyx_t_60 < 0) __pyx_t_60 += __pyx_v_AW.shape[1];
16538  __pyx_v_IMR = ((((pow((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_45 * __pyx_v_AW.strides[0]) ) + __pyx_t_46 * __pyx_v_AW.strides[1]) ))), 2.0) + pow((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_47 * __pyx_v_AW.strides[0]) ) + __pyx_t_48 * __pyx_v_AW.strides[1]) ))), 2.0)) + pow((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_49 * __pyx_v_AW.strides[0]) ) + __pyx_t_50 * __pyx_v_AW.strides[1]) ))), 2.0)) + pow((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_51 * __pyx_v_AW.strides[0]) ) + __pyx_t_52 * __pyx_v_AW.strides[1]) ))), 2.0)) / (2.0 * fabs((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_53 * __pyx_v_AW.strides[0]) ) + __pyx_t_54 * __pyx_v_AW.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_55 * __pyx_v_AW.strides[0]) ) + __pyx_t_56 * __pyx_v_AW.strides[1]) )))) - ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_57 * __pyx_v_AW.strides[0]) ) + __pyx_t_58 * __pyx_v_AW.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_59 * __pyx_v_AW.strides[0]) ) + __pyx_t_60 * __pyx_v_AW.strides[1]) ))))))));
16539 
16540  /* "mprans/MeshSmoothing.pyx":1092
16541  * AW = np.dot(A, np.linalg.inv(W))
16542  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0]))
16543  * IMR_node += IMR/3. # /3. because 3 nodes in element # <<<<<<<<<<<<<<
16544  * else:
16545  * if node == node0:
16546  */
16547  __pyx_v_IMR_node = (__pyx_v_IMR_node + (__pyx_v_IMR / 3.));
16548 
16549  /* "mprans/MeshSmoothing.pyx":1082
16550  * for iN in range(nNel):
16551  * node = elementNodesArray[eN, iN]
16552  * if el_average: # <<<<<<<<<<<<<<
16553  * vec_a = nodeArray[elementNodesArray[eN, iN]]
16554  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
16555  */
16556  goto __pyx_L7;
16557  }
16558 
16559  /* "mprans/MeshSmoothing.pyx":1094
16560  * IMR_node += IMR/3. # /3. because 3 nodes in element
16561  * else:
16562  * if node == node0: # <<<<<<<<<<<<<<
16563  * vec_a = nodeArray[elementNodesArray[eN, iN]]
16564  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
16565  */
16566  /*else*/ {
16567  __pyx_t_18 = ((__pyx_v_node == __pyx_v_node0) != 0);
16568  if (__pyx_t_18) {
16569 
16570  /* "mprans/MeshSmoothing.pyx":1095
16571  * else:
16572  * if node == node0:
16573  * vec_a = nodeArray[elementNodesArray[eN, iN]] # <<<<<<<<<<<<<<
16574  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
16575  * vec_c = nodeArray[elementNodesArray[eN, iN-2]]
16576  */
16577  __pyx_t_61 = __pyx_v_eN;
16578  __pyx_t_62 = __pyx_v_iN;
16579  if (__pyx_t_61 < 0) __pyx_t_61 += __pyx_v_elementNodesArray.shape[0];
16580  if (__pyx_t_62 < 0) __pyx_t_62 += __pyx_v_elementNodesArray.shape[1];
16581  __pyx_t_21.data = __pyx_v_nodeArray.data;
16582  __pyx_t_21.memview = __pyx_v_nodeArray.memview;
16583  __PYX_INC_MEMVIEW(&__pyx_t_21, 0);
16584  {
16585  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_61 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_62 * __pyx_v_elementNodesArray.strides[1]) )));
16586  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
16587  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
16588  if (__pyx_tmp_idx < 0)
16589  __pyx_tmp_idx += __pyx_tmp_shape;
16590  if ((0)) __PYX_ERR(0, 1095, __pyx_L1_error)
16591  __pyx_t_21.data += __pyx_tmp_idx * __pyx_tmp_stride;
16592 }
16593 
16594 __pyx_t_21.shape[0] = __pyx_v_nodeArray.shape[1];
16595 __pyx_t_21.strides[0] = __pyx_v_nodeArray.strides[1];
16596  __pyx_t_21.suboffsets[0] = -1;
16597 
16598 __PYX_XDEC_MEMVIEW(&__pyx_v_vec_a, 1);
16599  __pyx_v_vec_a = __pyx_t_21;
16600  __pyx_t_21.memview = NULL;
16601  __pyx_t_21.data = NULL;
16602 
16603  /* "mprans/MeshSmoothing.pyx":1096
16604  * if node == node0:
16605  * vec_a = nodeArray[elementNodesArray[eN, iN]]
16606  * vec_b = nodeArray[elementNodesArray[eN, iN-1]] # <<<<<<<<<<<<<<
16607  * vec_c = nodeArray[elementNodesArray[eN, iN-2]]
16608  * A[0,0] = vec_b[0]-vec_a[0]
16609  */
16610  __pyx_t_63 = __pyx_v_eN;
16611  __pyx_t_64 = (__pyx_v_iN - 1);
16612  if (__pyx_t_63 < 0) __pyx_t_63 += __pyx_v_elementNodesArray.shape[0];
16613  if (__pyx_t_64 < 0) __pyx_t_64 += __pyx_v_elementNodesArray.shape[1];
16614  __pyx_t_21.data = __pyx_v_nodeArray.data;
16615  __pyx_t_21.memview = __pyx_v_nodeArray.memview;
16616  __PYX_INC_MEMVIEW(&__pyx_t_21, 0);
16617  {
16618  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_63 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_64 * __pyx_v_elementNodesArray.strides[1]) )));
16619  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
16620  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
16621  if (__pyx_tmp_idx < 0)
16622  __pyx_tmp_idx += __pyx_tmp_shape;
16623  if ((0)) __PYX_ERR(0, 1096, __pyx_L1_error)
16624  __pyx_t_21.data += __pyx_tmp_idx * __pyx_tmp_stride;
16625 }
16626 
16627 __pyx_t_21.shape[0] = __pyx_v_nodeArray.shape[1];
16628 __pyx_t_21.strides[0] = __pyx_v_nodeArray.strides[1];
16629  __pyx_t_21.suboffsets[0] = -1;
16630 
16631 __PYX_XDEC_MEMVIEW(&__pyx_v_vec_b, 1);
16632  __pyx_v_vec_b = __pyx_t_21;
16633  __pyx_t_21.memview = NULL;
16634  __pyx_t_21.data = NULL;
16635 
16636  /* "mprans/MeshSmoothing.pyx":1097
16637  * vec_a = nodeArray[elementNodesArray[eN, iN]]
16638  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
16639  * vec_c = nodeArray[elementNodesArray[eN, iN-2]] # <<<<<<<<<<<<<<
16640  * A[0,0] = vec_b[0]-vec_a[0]
16641  * A[1,0] = vec_b[1]-vec_a[1]
16642  */
16643  __pyx_t_65 = __pyx_v_eN;
16644  __pyx_t_66 = (__pyx_v_iN - 2);
16645  if (__pyx_t_65 < 0) __pyx_t_65 += __pyx_v_elementNodesArray.shape[0];
16646  if (__pyx_t_66 < 0) __pyx_t_66 += __pyx_v_elementNodesArray.shape[1];
16647  __pyx_t_21.data = __pyx_v_nodeArray.data;
16648  __pyx_t_21.memview = __pyx_v_nodeArray.memview;
16649  __PYX_INC_MEMVIEW(&__pyx_t_21, 0);
16650  {
16651  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_65 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_66 * __pyx_v_elementNodesArray.strides[1]) )));
16652  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
16653  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
16654  if (__pyx_tmp_idx < 0)
16655  __pyx_tmp_idx += __pyx_tmp_shape;
16656  if ((0)) __PYX_ERR(0, 1097, __pyx_L1_error)
16657  __pyx_t_21.data += __pyx_tmp_idx * __pyx_tmp_stride;
16658 }
16659 
16660 __pyx_t_21.shape[0] = __pyx_v_nodeArray.shape[1];
16661 __pyx_t_21.strides[0] = __pyx_v_nodeArray.strides[1];
16662  __pyx_t_21.suboffsets[0] = -1;
16663 
16664 __PYX_XDEC_MEMVIEW(&__pyx_v_vec_c, 1);
16665  __pyx_v_vec_c = __pyx_t_21;
16666  __pyx_t_21.memview = NULL;
16667  __pyx_t_21.data = NULL;
16668 
16669  /* "mprans/MeshSmoothing.pyx":1098
16670  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
16671  * vec_c = nodeArray[elementNodesArray[eN, iN-2]]
16672  * A[0,0] = vec_b[0]-vec_a[0] # <<<<<<<<<<<<<<
16673  * A[1,0] = vec_b[1]-vec_a[1]
16674  * A[0,1] = vec_c[0]-vec_a[0]
16675  */
16676  __pyx_t_67 = 0;
16677  if (__pyx_t_67 < 0) __pyx_t_67 += __pyx_v_vec_b.shape[0];
16678  __pyx_t_68 = 0;
16679  if (__pyx_t_68 < 0) __pyx_t_68 += __pyx_v_vec_a.shape[0];
16680  __pyx_t_69 = 0;
16681  __pyx_t_70 = 0;
16682  if (__pyx_t_69 < 0) __pyx_t_69 += __pyx_v_A.shape[0];
16683  if (__pyx_t_70 < 0) __pyx_t_70 += __pyx_v_A.shape[1];
16684  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_A.data + __pyx_t_69 * __pyx_v_A.strides[0]) ) + __pyx_t_70 * __pyx_v_A.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vec_b.data + __pyx_t_67 * __pyx_v_vec_b.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_vec_a.data + __pyx_t_68 * __pyx_v_vec_a.strides[0]) ))));
16685 
16686  /* "mprans/MeshSmoothing.pyx":1099
16687  * vec_c = nodeArray[elementNodesArray[eN, iN-2]]
16688  * A[0,0] = vec_b[0]-vec_a[0]
16689  * A[1,0] = vec_b[1]-vec_a[1] # <<<<<<<<<<<<<<
16690  * A[0,1] = vec_c[0]-vec_a[0]
16691  * A[1,1] = vec_c[1]-vec_a[1]
16692  */
16693  __pyx_t_71 = 1;
16694  if (__pyx_t_71 < 0) __pyx_t_71 += __pyx_v_vec_b.shape[0];
16695  __pyx_t_72 = 1;
16696  if (__pyx_t_72 < 0) __pyx_t_72 += __pyx_v_vec_a.shape[0];
16697  __pyx_t_73 = 1;
16698  __pyx_t_74 = 0;
16699  if (__pyx_t_73 < 0) __pyx_t_73 += __pyx_v_A.shape[0];
16700  if (__pyx_t_74 < 0) __pyx_t_74 += __pyx_v_A.shape[1];
16701  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_A.data + __pyx_t_73 * __pyx_v_A.strides[0]) ) + __pyx_t_74 * __pyx_v_A.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vec_b.data + __pyx_t_71 * __pyx_v_vec_b.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_vec_a.data + __pyx_t_72 * __pyx_v_vec_a.strides[0]) ))));
16702 
16703  /* "mprans/MeshSmoothing.pyx":1100
16704  * A[0,0] = vec_b[0]-vec_a[0]
16705  * A[1,0] = vec_b[1]-vec_a[1]
16706  * A[0,1] = vec_c[0]-vec_a[0] # <<<<<<<<<<<<<<
16707  * A[1,1] = vec_c[1]-vec_a[1]
16708  * AW = np.dot(A, np.linalg.inv(W))
16709  */
16710  __pyx_t_75 = 0;
16711  if (__pyx_t_75 < 0) __pyx_t_75 += __pyx_v_vec_c.shape[0];
16712  __pyx_t_76 = 0;
16713  if (__pyx_t_76 < 0) __pyx_t_76 += __pyx_v_vec_a.shape[0];
16714  __pyx_t_77 = 0;
16715  __pyx_t_78 = 1;
16716  if (__pyx_t_77 < 0) __pyx_t_77 += __pyx_v_A.shape[0];
16717  if (__pyx_t_78 < 0) __pyx_t_78 += __pyx_v_A.shape[1];
16718  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_A.data + __pyx_t_77 * __pyx_v_A.strides[0]) ) + __pyx_t_78 * __pyx_v_A.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vec_c.data + __pyx_t_75 * __pyx_v_vec_c.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_vec_a.data + __pyx_t_76 * __pyx_v_vec_a.strides[0]) ))));
16719 
16720  /* "mprans/MeshSmoothing.pyx":1101
16721  * A[1,0] = vec_b[1]-vec_a[1]
16722  * A[0,1] = vec_c[0]-vec_a[0]
16723  * A[1,1] = vec_c[1]-vec_a[1] # <<<<<<<<<<<<<<
16724  * AW = np.dot(A, np.linalg.inv(W))
16725  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0]))
16726  */
16727  __pyx_t_79 = 1;
16728  if (__pyx_t_79 < 0) __pyx_t_79 += __pyx_v_vec_c.shape[0];
16729  __pyx_t_80 = 1;
16730  if (__pyx_t_80 < 0) __pyx_t_80 += __pyx_v_vec_a.shape[0];
16731  __pyx_t_81 = 1;
16732  __pyx_t_82 = 1;
16733  if (__pyx_t_81 < 0) __pyx_t_81 += __pyx_v_A.shape[0];
16734  if (__pyx_t_82 < 0) __pyx_t_82 += __pyx_v_A.shape[1];
16735  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_A.data + __pyx_t_81 * __pyx_v_A.strides[0]) ) + __pyx_t_82 * __pyx_v_A.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vec_c.data + __pyx_t_79 * __pyx_v_vec_c.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_vec_a.data + __pyx_t_80 * __pyx_v_vec_a.strides[0]) ))));
16736 
16737  /* "mprans/MeshSmoothing.pyx":1102
16738  * A[0,1] = vec_c[0]-vec_a[0]
16739  * A[1,1] = vec_c[1]-vec_a[1]
16740  * AW = np.dot(A, np.linalg.inv(W)) # <<<<<<<<<<<<<<
16741  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0]))
16742  * IMR_node += IMR
16743  */
16744  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1102, __pyx_L1_error)
16745  __Pyx_GOTREF(__pyx_t_4);
16746  __pyx_t_42 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_dot); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 1102, __pyx_L1_error)
16747  __Pyx_GOTREF(__pyx_t_42);
16748  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16749  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_A, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1102, __pyx_L1_error)
16750  __Pyx_GOTREF(__pyx_t_4);
16751  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1102, __pyx_L1_error)
16752  __Pyx_GOTREF(__pyx_t_3);
16753  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_linalg); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1102, __pyx_L1_error)
16754  __Pyx_GOTREF(__pyx_t_2);
16755  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16756  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_inv); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1102, __pyx_L1_error)
16757  __Pyx_GOTREF(__pyx_t_3);
16758  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16759  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_W, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1102, __pyx_L1_error)
16760  __Pyx_GOTREF(__pyx_t_2);
16761  __pyx_t_43 = NULL;
16762  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
16763  __pyx_t_43 = PyMethod_GET_SELF(__pyx_t_3);
16764  if (likely(__pyx_t_43)) {
16765  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
16766  __Pyx_INCREF(__pyx_t_43);
16767  __Pyx_INCREF(function);
16768  __Pyx_DECREF_SET(__pyx_t_3, function);
16769  }
16770  }
16771  __pyx_t_5 = (__pyx_t_43) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_43, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
16772  __Pyx_XDECREF(__pyx_t_43); __pyx_t_43 = 0;
16773  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16774  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1102, __pyx_L1_error)
16775  __Pyx_GOTREF(__pyx_t_5);
16776  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16777  __pyx_t_3 = NULL;
16778  __pyx_t_44 = 0;
16779  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_42))) {
16780  __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_42);
16781  if (likely(__pyx_t_3)) {
16782  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_42);
16783  __Pyx_INCREF(__pyx_t_3);
16784  __Pyx_INCREF(function);
16785  __Pyx_DECREF_SET(__pyx_t_42, function);
16786  __pyx_t_44 = 1;
16787  }
16788  }
16789  #if CYTHON_FAST_PYCALL
16790  if (PyFunction_Check(__pyx_t_42)) {
16791  PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_4, __pyx_t_5};
16792  __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_42, __pyx_temp+1-__pyx_t_44, 2+__pyx_t_44); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1102, __pyx_L1_error)
16793  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
16794  __Pyx_GOTREF(__pyx_t_1);
16795  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16796  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
16797  } else
16798  #endif
16799  #if CYTHON_FAST_PYCCALL
16800  if (__Pyx_PyFastCFunction_Check(__pyx_t_42)) {
16801  PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_4, __pyx_t_5};
16802  __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_42, __pyx_temp+1-__pyx_t_44, 2+__pyx_t_44); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1102, __pyx_L1_error)
16803  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
16804  __Pyx_GOTREF(__pyx_t_1);
16805  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16806  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
16807  } else
16808  #endif
16809  {
16810  __pyx_t_2 = PyTuple_New(2+__pyx_t_44); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1102, __pyx_L1_error)
16811  __Pyx_GOTREF(__pyx_t_2);
16812  if (__pyx_t_3) {
16813  __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
16814  }
16815  __Pyx_GIVEREF(__pyx_t_4);
16816  PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_44, __pyx_t_4);
16817  __Pyx_GIVEREF(__pyx_t_5);
16818  PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_44, __pyx_t_5);
16819  __pyx_t_4 = 0;
16820  __pyx_t_5 = 0;
16821  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_42, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1102, __pyx_L1_error)
16822  __Pyx_GOTREF(__pyx_t_1);
16823  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16824  }
16825  __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0;
16826  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1102, __pyx_L1_error)
16827  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16828  __PYX_XDEC_MEMVIEW(&__pyx_v_AW, 1);
16829  __pyx_v_AW = __pyx_t_6;
16830  __pyx_t_6.memview = NULL;
16831  __pyx_t_6.data = NULL;
16832 
16833  /* "mprans/MeshSmoothing.pyx":1103
16834  * A[1,1] = vec_c[1]-vec_a[1]
16835  * AW = np.dot(A, np.linalg.inv(W))
16836  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0])) # <<<<<<<<<<<<<<
16837  * IMR_node += IMR
16838  * IMR_node = IMR_node/nEl
16839  */
16840  __pyx_t_83 = 0;
16841  __pyx_t_84 = 0;
16842  if (__pyx_t_83 < 0) __pyx_t_83 += __pyx_v_AW.shape[0];
16843  if (__pyx_t_84 < 0) __pyx_t_84 += __pyx_v_AW.shape[1];
16844  __pyx_t_85 = 0;
16845  __pyx_t_86 = 1;
16846  if (__pyx_t_85 < 0) __pyx_t_85 += __pyx_v_AW.shape[0];
16847  if (__pyx_t_86 < 0) __pyx_t_86 += __pyx_v_AW.shape[1];
16848  __pyx_t_87 = 1;
16849  __pyx_t_88 = 0;
16850  if (__pyx_t_87 < 0) __pyx_t_87 += __pyx_v_AW.shape[0];
16851  if (__pyx_t_88 < 0) __pyx_t_88 += __pyx_v_AW.shape[1];
16852  __pyx_t_89 = 1;
16853  __pyx_t_90 = 1;
16854  if (__pyx_t_89 < 0) __pyx_t_89 += __pyx_v_AW.shape[0];
16855  if (__pyx_t_90 < 0) __pyx_t_90 += __pyx_v_AW.shape[1];
16856  __pyx_t_91 = 0;
16857  __pyx_t_92 = 0;
16858  if (__pyx_t_91 < 0) __pyx_t_91 += __pyx_v_AW.shape[0];
16859  if (__pyx_t_92 < 0) __pyx_t_92 += __pyx_v_AW.shape[1];
16860  __pyx_t_93 = 1;
16861  __pyx_t_94 = 1;
16862  if (__pyx_t_93 < 0) __pyx_t_93 += __pyx_v_AW.shape[0];
16863  if (__pyx_t_94 < 0) __pyx_t_94 += __pyx_v_AW.shape[1];
16864  __pyx_t_95 = 0;
16865  __pyx_t_96 = 1;
16866  if (__pyx_t_95 < 0) __pyx_t_95 += __pyx_v_AW.shape[0];
16867  if (__pyx_t_96 < 0) __pyx_t_96 += __pyx_v_AW.shape[1];
16868  __pyx_t_97 = 1;
16869  __pyx_t_98 = 0;
16870  if (__pyx_t_97 < 0) __pyx_t_97 += __pyx_v_AW.shape[0];
16871  if (__pyx_t_98 < 0) __pyx_t_98 += __pyx_v_AW.shape[1];
16872  __pyx_v_IMR = ((((pow((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_83 * __pyx_v_AW.strides[0]) ) + __pyx_t_84 * __pyx_v_AW.strides[1]) ))), 2.0) + pow((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_85 * __pyx_v_AW.strides[0]) ) + __pyx_t_86 * __pyx_v_AW.strides[1]) ))), 2.0)) + pow((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_87 * __pyx_v_AW.strides[0]) ) + __pyx_t_88 * __pyx_v_AW.strides[1]) ))), 2.0)) + pow((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_89 * __pyx_v_AW.strides[0]) ) + __pyx_t_90 * __pyx_v_AW.strides[1]) ))), 2.0)) / (2.0 * fabs((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_91 * __pyx_v_AW.strides[0]) ) + __pyx_t_92 * __pyx_v_AW.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_93 * __pyx_v_AW.strides[0]) ) + __pyx_t_94 * __pyx_v_AW.strides[1]) )))) - ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_95 * __pyx_v_AW.strides[0]) ) + __pyx_t_96 * __pyx_v_AW.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_97 * __pyx_v_AW.strides[0]) ) + __pyx_t_98 * __pyx_v_AW.strides[1]) ))))))));
16873 
16874  /* "mprans/MeshSmoothing.pyx":1104
16875  * AW = np.dot(A, np.linalg.inv(W))
16876  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0]))
16877  * IMR_node += IMR # <<<<<<<<<<<<<<
16878  * IMR_node = IMR_node/nEl
16879  * return IMR_node
16880  */
16881  __pyx_v_IMR_node = (__pyx_v_IMR_node + __pyx_v_IMR);
16882 
16883  /* "mprans/MeshSmoothing.pyx":1094
16884  * IMR_node += IMR/3. # /3. because 3 nodes in element
16885  * else:
16886  * if node == node0: # <<<<<<<<<<<<<<
16887  * vec_a = nodeArray[elementNodesArray[eN, iN]]
16888  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
16889  */
16890  }
16891  }
16892  __pyx_L7:;
16893  }
16894  }
16895 
16896  /* "mprans/MeshSmoothing.pyx":1105
16897  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0]))
16898  * IMR_node += IMR
16899  * IMR_node = IMR_node/nEl # <<<<<<<<<<<<<<
16900  * return IMR_node
16901  *
16902  */
16903  __pyx_v_IMR_node = (__pyx_v_IMR_node / __pyx_v_nEl);
16904 
16905  /* "mprans/MeshSmoothing.pyx":1106
16906  * IMR_node += IMR
16907  * IMR_node = IMR_node/nEl
16908  * return IMR_node # <<<<<<<<<<<<<<
16909  *
16910  * cdef double[:,:] cySmoothNodesQuality(double[:] distortion,
16911  */
16912  __pyx_r = __pyx_v_IMR_node;
16913  goto __pyx_L0;
16914 
16915  /* "mprans/MeshSmoothing.pyx":1054
16916  * IMRElementsArray_[eN] = IMRElementsArray_[eN]/3.
16917  *
16918  * cdef double cyGetInverseMeanRatioSingleTriangle(int node0, # <<<<<<<<<<<<<<
16919  * double[:,:] nodeArray,
16920  * int[:,:] elementNodesArray,
16921  */
16922 
16923  /* function exit code */
16924  __pyx_L1_error:;
16925  __Pyx_XDECREF(__pyx_t_1);
16926  __Pyx_XDECREF(__pyx_t_2);
16927  __Pyx_XDECREF(__pyx_t_3);
16928  __Pyx_XDECREF(__pyx_t_4);
16929  __Pyx_XDECREF(__pyx_t_5);
16930  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
16931  __PYX_XDEC_MEMVIEW(&__pyx_t_21, 1);
16932  __Pyx_XDECREF(__pyx_t_42);
16933  __Pyx_XDECREF(__pyx_t_43);
16934  __Pyx_WriteUnraisable("mprans.MeshSmoothing.cyGetInverseMeanRatioSingleTriangle", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
16935  __pyx_r = 0;
16936  __pyx_L0:;
16937  __PYX_XDEC_MEMVIEW(&__pyx_v_W, 1);
16938  __PYX_XDEC_MEMVIEW(&__pyx_v_A, 1);
16939  __PYX_XDEC_MEMVIEW(&__pyx_v_AW, 1);
16940  __PYX_XDEC_MEMVIEW(&__pyx_v_vec_a, 1);
16941  __PYX_XDEC_MEMVIEW(&__pyx_v_vec_b, 1);
16942  __PYX_XDEC_MEMVIEW(&__pyx_v_vec_c, 1);
16943  __Pyx_RefNannyFinishContext();
16944  return __pyx_r;
16945 }
16946 
16947 /* "mprans/MeshSmoothing.pyx":1108
16948  * return IMR_node
16949  *
16950  * cdef double[:,:] cySmoothNodesQuality(double[:] distortion, # <<<<<<<<<<<<<<
16951  * double[:] dilation,
16952  * double[:,:] nodeArray,
16953  */
16954 
16955 static __Pyx_memviewslice __pyx_f_6mprans_13MeshSmoothing_cySmoothNodesQuality(__Pyx_memviewslice __pyx_v_distortion, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_dilation, __Pyx_memviewslice __pyx_v_nodeArray, int __pyx_v_nNodes_owned, __Pyx_memviewslice __pyx_v_nodeMaterialTypes, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_elementNodesArray, struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesQuality *__pyx_optional_args) {
16956 
16957  /* "mprans/MeshSmoothing.pyx":1116
16958  * int[:] nodeElementsArray,
16959  * int[:,:] elementNodesArray,
16960  * bool apply_directly=False): # <<<<<<<<<<<<<<
16961  * cdef double[:,:] disp = nodeArray.copy()
16962  * cdef double[:,:] nodeArrayMod
16963  */
16964  bool __pyx_v_apply_directly = ((bool)0);
16965  __Pyx_memviewslice __pyx_v_disp = { 0, 0, { 0 }, { 0 }, { 0 } };
16966  __Pyx_memviewslice __pyx_v_nodeArrayMod = { 0, 0, { 0 }, { 0 }, { 0 } };
16967  double __pyx_v_weighted_pos[3];
16968  int __pyx_v_nNel;
16969  double __pyx_v_weight;
16970  double __pyx_v_weights;
16971  int __pyx_v_node;
16972  int __pyx_v_eOffset;
16973  int __pyx_v_eN;
16974  int __pyx_v_eNnode;
16975  int __pyx_v_iN;
16976  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
16977  __Pyx_RefNannyDeclarations
16978  __Pyx_memviewslice __pyx_t_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
16979  int __pyx_t_2;
16980  int __pyx_t_3;
16981  int __pyx_t_4;
16982  int __pyx_t_5;
16983  Py_ssize_t __pyx_t_6;
16984  Py_ssize_t __pyx_t_7;
16985  int __pyx_t_8;
16986  Py_ssize_t __pyx_t_9;
16987  int __pyx_t_10;
16988  int __pyx_t_11;
16989  Py_ssize_t __pyx_t_12;
16990  int __pyx_t_13;
16991  int __pyx_t_14;
16992  int __pyx_t_15;
16993  Py_ssize_t __pyx_t_16;
16994  Py_ssize_t __pyx_t_17;
16995  Py_ssize_t __pyx_t_18;
16996  long __pyx_t_19;
16997  Py_ssize_t __pyx_t_20;
16998  Py_ssize_t __pyx_t_21;
16999  Py_ssize_t __pyx_t_22;
17000  Py_ssize_t __pyx_t_23;
17001  Py_ssize_t __pyx_t_24;
17002  Py_ssize_t __pyx_t_25;
17003  Py_ssize_t __pyx_t_26;
17004  Py_ssize_t __pyx_t_27;
17005  Py_ssize_t __pyx_t_28;
17006  Py_ssize_t __pyx_t_29;
17007  Py_ssize_t __pyx_t_30;
17008  Py_ssize_t __pyx_t_31;
17009  Py_ssize_t __pyx_t_32;
17010  Py_ssize_t __pyx_t_33;
17011  Py_ssize_t __pyx_t_34;
17012  Py_ssize_t __pyx_t_35;
17013  Py_ssize_t __pyx_t_36;
17014  Py_ssize_t __pyx_t_37;
17015  Py_ssize_t __pyx_t_38;
17016  Py_ssize_t __pyx_t_39;
17017  Py_ssize_t __pyx_t_40;
17018  Py_ssize_t __pyx_t_41;
17019  Py_ssize_t __pyx_t_42;
17020  Py_ssize_t __pyx_t_43;
17021  Py_ssize_t __pyx_t_44;
17022  Py_ssize_t __pyx_t_45;
17023  Py_ssize_t __pyx_t_46;
17024  Py_ssize_t __pyx_t_47;
17025  Py_ssize_t __pyx_t_48;
17026  Py_ssize_t __pyx_t_49;
17027  __Pyx_RefNannySetupContext("cySmoothNodesQuality", 0);
17028  if (__pyx_optional_args) {
17029  if (__pyx_optional_args->__pyx_n > 0) {
17030  __pyx_v_apply_directly = __pyx_optional_args->apply_directly;
17031  }
17032  }
17033 
17034  /* "mprans/MeshSmoothing.pyx":1117
17035  * int[:,:] elementNodesArray,
17036  * bool apply_directly=False):
17037  * cdef double[:,:] disp = nodeArray.copy() # <<<<<<<<<<<<<<
17038  * cdef double[:,:] nodeArrayMod
17039  * if not apply_directly:
17040  */
17041  __pyx_t_1 = __pyx_memoryview_copy_slice_d_dc_double_c(__pyx_v_nodeArray); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 1117, __pyx_L1_error)
17042  __pyx_v_disp = __pyx_t_1;
17043  __pyx_t_1.memview = NULL;
17044  __pyx_t_1.data = NULL;
17045 
17046  /* "mprans/MeshSmoothing.pyx":1119
17047  * cdef double[:,:] disp = nodeArray.copy()
17048  * cdef double[:,:] nodeArrayMod
17049  * if not apply_directly: # <<<<<<<<<<<<<<
17050  * nodeArrayMod = nodeArray.copy()
17051  * else:
17052  */
17053  __pyx_t_2 = ((!(__pyx_v_apply_directly != 0)) != 0);
17054  if (__pyx_t_2) {
17055 
17056  /* "mprans/MeshSmoothing.pyx":1120
17057  * cdef double[:,:] nodeArrayMod
17058  * if not apply_directly:
17059  * nodeArrayMod = nodeArray.copy() # <<<<<<<<<<<<<<
17060  * else:
17061  * nodeArrayMod = nodeArray
17062  */
17063  __pyx_t_1 = __pyx_memoryview_copy_slice_d_dc_double_c(__pyx_v_nodeArray); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 1120, __pyx_L1_error)
17064  __pyx_v_nodeArrayMod = __pyx_t_1;
17065  __pyx_t_1.memview = NULL;
17066  __pyx_t_1.data = NULL;
17067 
17068  /* "mprans/MeshSmoothing.pyx":1119
17069  * cdef double[:,:] disp = nodeArray.copy()
17070  * cdef double[:,:] nodeArrayMod
17071  * if not apply_directly: # <<<<<<<<<<<<<<
17072  * nodeArrayMod = nodeArray.copy()
17073  * else:
17074  */
17075  goto __pyx_L3;
17076  }
17077 
17078  /* "mprans/MeshSmoothing.pyx":1122
17079  * nodeArrayMod = nodeArray.copy()
17080  * else:
17081  * nodeArrayMod = nodeArray # <<<<<<<<<<<<<<
17082  * cdef double[3] weighted_pos
17083  * cdef int nNel = elementNodesArray.shape[1]
17084  */
17085  /*else*/ {
17086  __PYX_INC_MEMVIEW(&__pyx_v_nodeArray, 0);
17087  __pyx_v_nodeArrayMod = __pyx_v_nodeArray;
17088  }
17089  __pyx_L3:;
17090 
17091  /* "mprans/MeshSmoothing.pyx":1124
17092  * nodeArrayMod = nodeArray
17093  * cdef double[3] weighted_pos
17094  * cdef int nNel = elementNodesArray.shape[1] # <<<<<<<<<<<<<<
17095  * cdef double weight = 0
17096  * cdef double weights = 0
17097  */
17098  __pyx_v_nNel = (__pyx_v_elementNodesArray.shape[1]);
17099 
17100  /* "mprans/MeshSmoothing.pyx":1125
17101  * cdef double[3] weighted_pos
17102  * cdef int nNel = elementNodesArray.shape[1]
17103  * cdef double weight = 0 # <<<<<<<<<<<<<<
17104  * cdef double weights = 0
17105  * cdef int node
17106  */
17107  __pyx_v_weight = 0.0;
17108 
17109  /* "mprans/MeshSmoothing.pyx":1126
17110  * cdef int nNel = elementNodesArray.shape[1]
17111  * cdef double weight = 0
17112  * cdef double weights = 0 # <<<<<<<<<<<<<<
17113  * cdef int node
17114  * cdef int eOffset
17115  */
17116  __pyx_v_weights = 0.0;
17117 
17118  /* "mprans/MeshSmoothing.pyx":1132
17119  * cdef int eNnode
17120  * cdef int iN
17121  * for node in range(nNodes_owned): # <<<<<<<<<<<<<<
17122  * if nodeMaterialTypes[node] == 0:
17123  * weights = 0
17124  */
17125  __pyx_t_3 = __pyx_v_nNodes_owned;
17126  __pyx_t_4 = __pyx_t_3;
17127  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
17128  __pyx_v_node = __pyx_t_5;
17129 
17130  /* "mprans/MeshSmoothing.pyx":1133
17131  * cdef int iN
17132  * for node in range(nNodes_owned):
17133  * if nodeMaterialTypes[node] == 0: # <<<<<<<<<<<<<<
17134  * weights = 0
17135  * weighted_pos[0] = 0
17136  */
17137  __pyx_t_6 = __pyx_v_node;
17138  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_nodeMaterialTypes.shape[0];
17139  __pyx_t_2 = (((*((int *) ( /* dim=0 */ (__pyx_v_nodeMaterialTypes.data + __pyx_t_6 * __pyx_v_nodeMaterialTypes.strides[0]) ))) == 0) != 0);
17140  if (__pyx_t_2) {
17141 
17142  /* "mprans/MeshSmoothing.pyx":1134
17143  * for node in range(nNodes_owned):
17144  * if nodeMaterialTypes[node] == 0:
17145  * weights = 0 # <<<<<<<<<<<<<<
17146  * weighted_pos[0] = 0
17147  * weighted_pos[1] = 0
17148  */
17149  __pyx_v_weights = 0.0;
17150 
17151  /* "mprans/MeshSmoothing.pyx":1135
17152  * if nodeMaterialTypes[node] == 0:
17153  * weights = 0
17154  * weighted_pos[0] = 0 # <<<<<<<<<<<<<<
17155  * weighted_pos[1] = 0
17156  * weighted_pos[2] = 0
17157  */
17158  (__pyx_v_weighted_pos[0]) = 0.0;
17159 
17160  /* "mprans/MeshSmoothing.pyx":1136
17161  * weights = 0
17162  * weighted_pos[0] = 0
17163  * weighted_pos[1] = 0 # <<<<<<<<<<<<<<
17164  * weighted_pos[2] = 0
17165  * for eOffset in range(nodeElementOffsets[node],
17166  */
17167  (__pyx_v_weighted_pos[1]) = 0.0;
17168 
17169  /* "mprans/MeshSmoothing.pyx":1137
17170  * weighted_pos[0] = 0
17171  * weighted_pos[1] = 0
17172  * weighted_pos[2] = 0 # <<<<<<<<<<<<<<
17173  * for eOffset in range(nodeElementOffsets[node],
17174  * nodeElementOffsets[node+1]):
17175  */
17176  (__pyx_v_weighted_pos[2]) = 0.0;
17177 
17178  /* "mprans/MeshSmoothing.pyx":1139
17179  * weighted_pos[2] = 0
17180  * for eOffset in range(nodeElementOffsets[node],
17181  * nodeElementOffsets[node+1]): # <<<<<<<<<<<<<<
17182  * eN = nodeElementsArray[eOffset]
17183  * for iN in range(nNel):
17184  */
17185  __pyx_t_7 = (__pyx_v_node + 1);
17186  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_nodeElementOffsets.shape[0];
17187  __pyx_t_8 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_7 * __pyx_v_nodeElementOffsets.strides[0]) )));
17188 
17189  /* "mprans/MeshSmoothing.pyx":1138
17190  * weighted_pos[1] = 0
17191  * weighted_pos[2] = 0
17192  * for eOffset in range(nodeElementOffsets[node], # <<<<<<<<<<<<<<
17193  * nodeElementOffsets[node+1]):
17194  * eN = nodeElementsArray[eOffset]
17195  */
17196  __pyx_t_9 = __pyx_v_node;
17197  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_nodeElementOffsets.shape[0];
17198 
17199  /* "mprans/MeshSmoothing.pyx":1139
17200  * weighted_pos[2] = 0
17201  * for eOffset in range(nodeElementOffsets[node],
17202  * nodeElementOffsets[node+1]): # <<<<<<<<<<<<<<
17203  * eN = nodeElementsArray[eOffset]
17204  * for iN in range(nNel):
17205  */
17206  __pyx_t_10 = __pyx_t_8;
17207  for (__pyx_t_11 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_9 * __pyx_v_nodeElementOffsets.strides[0]) ))); __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
17208 
17209  /* "mprans/MeshSmoothing.pyx":1138
17210  * weighted_pos[1] = 0
17211  * weighted_pos[2] = 0
17212  * for eOffset in range(nodeElementOffsets[node], # <<<<<<<<<<<<<<
17213  * nodeElementOffsets[node+1]):
17214  * eN = nodeElementsArray[eOffset]
17215  */
17216  __pyx_v_eOffset = __pyx_t_11;
17217 
17218  /* "mprans/MeshSmoothing.pyx":1140
17219  * for eOffset in range(nodeElementOffsets[node],
17220  * nodeElementOffsets[node+1]):
17221  * eN = nodeElementsArray[eOffset] # <<<<<<<<<<<<<<
17222  * for iN in range(nNel):
17223  * eNnode = elementNodesArray[eN, iN]
17224  */
17225  __pyx_t_12 = __pyx_v_eOffset;
17226  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_nodeElementsArray.shape[0];
17227  __pyx_v_eN = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementsArray.data + __pyx_t_12 * __pyx_v_nodeElementsArray.strides[0]) )));
17228 
17229  /* "mprans/MeshSmoothing.pyx":1141
17230  * nodeElementOffsets[node+1]):
17231  * eN = nodeElementsArray[eOffset]
17232  * for iN in range(nNel): # <<<<<<<<<<<<<<
17233  * eNnode = elementNodesArray[eN, iN]
17234  * if eNnode != node:
17235  */
17236  __pyx_t_13 = __pyx_v_nNel;
17237  __pyx_t_14 = __pyx_t_13;
17238  for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
17239  __pyx_v_iN = __pyx_t_15;
17240 
17241  /* "mprans/MeshSmoothing.pyx":1142
17242  * eN = nodeElementsArray[eOffset]
17243  * for iN in range(nNel):
17244  * eNnode = elementNodesArray[eN, iN] # <<<<<<<<<<<<<<
17245  * if eNnode != node:
17246  * weight = distortion[eN]
17247  */
17248  __pyx_t_16 = __pyx_v_eN;
17249  __pyx_t_17 = __pyx_v_iN;
17250  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_elementNodesArray.shape[0];
17251  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_elementNodesArray.shape[1];
17252  __pyx_v_eNnode = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_16 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_17 * __pyx_v_elementNodesArray.strides[1]) )));
17253 
17254  /* "mprans/MeshSmoothing.pyx":1143
17255  * for iN in range(nNel):
17256  * eNnode = elementNodesArray[eN, iN]
17257  * if eNnode != node: # <<<<<<<<<<<<<<
17258  * weight = distortion[eN]
17259  * weighted_pos[0] += nodeArrayMod[eNnode, 0]*weight
17260  */
17261  __pyx_t_2 = ((__pyx_v_eNnode != __pyx_v_node) != 0);
17262  if (__pyx_t_2) {
17263 
17264  /* "mprans/MeshSmoothing.pyx":1144
17265  * eNnode = elementNodesArray[eN, iN]
17266  * if eNnode != node:
17267  * weight = distortion[eN] # <<<<<<<<<<<<<<
17268  * weighted_pos[0] += nodeArrayMod[eNnode, 0]*weight
17269  * weighted_pos[1] += nodeArrayMod[eNnode, 1]*weight
17270  */
17271  __pyx_t_18 = __pyx_v_eN;
17272  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_distortion.shape[0];
17273  __pyx_v_weight = (*((double *) ( /* dim=0 */ (__pyx_v_distortion.data + __pyx_t_18 * __pyx_v_distortion.strides[0]) )));
17274 
17275  /* "mprans/MeshSmoothing.pyx":1145
17276  * if eNnode != node:
17277  * weight = distortion[eN]
17278  * weighted_pos[0] += nodeArrayMod[eNnode, 0]*weight # <<<<<<<<<<<<<<
17279  * weighted_pos[1] += nodeArrayMod[eNnode, 1]*weight
17280  * weighted_pos[2] += nodeArrayMod[eNnode, 2]*weight
17281  */
17282  __pyx_t_19 = 0;
17283  __pyx_t_20 = __pyx_v_eNnode;
17284  __pyx_t_21 = 0;
17285  if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_nodeArrayMod.shape[0];
17286  if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_nodeArrayMod.shape[1];
17287  (__pyx_v_weighted_pos[__pyx_t_19]) = ((__pyx_v_weighted_pos[__pyx_t_19]) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArrayMod.data + __pyx_t_20 * __pyx_v_nodeArrayMod.strides[0]) ) + __pyx_t_21 * __pyx_v_nodeArrayMod.strides[1]) ))) * __pyx_v_weight));
17288 
17289  /* "mprans/MeshSmoothing.pyx":1146
17290  * weight = distortion[eN]
17291  * weighted_pos[0] += nodeArrayMod[eNnode, 0]*weight
17292  * weighted_pos[1] += nodeArrayMod[eNnode, 1]*weight # <<<<<<<<<<<<<<
17293  * weighted_pos[2] += nodeArrayMod[eNnode, 2]*weight
17294  * weights += weight
17295  */
17296  __pyx_t_19 = 1;
17297  __pyx_t_22 = __pyx_v_eNnode;
17298  __pyx_t_23 = 1;
17299  if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_nodeArrayMod.shape[0];
17300  if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_nodeArrayMod.shape[1];
17301  (__pyx_v_weighted_pos[__pyx_t_19]) = ((__pyx_v_weighted_pos[__pyx_t_19]) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArrayMod.data + __pyx_t_22 * __pyx_v_nodeArrayMod.strides[0]) ) + __pyx_t_23 * __pyx_v_nodeArrayMod.strides[1]) ))) * __pyx_v_weight));
17302 
17303  /* "mprans/MeshSmoothing.pyx":1147
17304  * weighted_pos[0] += nodeArrayMod[eNnode, 0]*weight
17305  * weighted_pos[1] += nodeArrayMod[eNnode, 1]*weight
17306  * weighted_pos[2] += nodeArrayMod[eNnode, 2]*weight # <<<<<<<<<<<<<<
17307  * weights += weight
17308  * nodeArrayMod[node, 0] = weighted_pos[0]/weights
17309  */
17310  __pyx_t_19 = 2;
17311  __pyx_t_24 = __pyx_v_eNnode;
17312  __pyx_t_25 = 2;
17313  if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_nodeArrayMod.shape[0];
17314  if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_nodeArrayMod.shape[1];
17315  (__pyx_v_weighted_pos[__pyx_t_19]) = ((__pyx_v_weighted_pos[__pyx_t_19]) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArrayMod.data + __pyx_t_24 * __pyx_v_nodeArrayMod.strides[0]) ) + __pyx_t_25 * __pyx_v_nodeArrayMod.strides[1]) ))) * __pyx_v_weight));
17316 
17317  /* "mprans/MeshSmoothing.pyx":1148
17318  * weighted_pos[1] += nodeArrayMod[eNnode, 1]*weight
17319  * weighted_pos[2] += nodeArrayMod[eNnode, 2]*weight
17320  * weights += weight # <<<<<<<<<<<<<<
17321  * nodeArrayMod[node, 0] = weighted_pos[0]/weights
17322  * nodeArrayMod[node, 1] = weighted_pos[1]/weights
17323  */
17324  __pyx_v_weights = (__pyx_v_weights + __pyx_v_weight);
17325 
17326  /* "mprans/MeshSmoothing.pyx":1143
17327  * for iN in range(nNel):
17328  * eNnode = elementNodesArray[eN, iN]
17329  * if eNnode != node: # <<<<<<<<<<<<<<
17330  * weight = distortion[eN]
17331  * weighted_pos[0] += nodeArrayMod[eNnode, 0]*weight
17332  */
17333  }
17334  }
17335 
17336  /* "mprans/MeshSmoothing.pyx":1149
17337  * weighted_pos[2] += nodeArrayMod[eNnode, 2]*weight
17338  * weights += weight
17339  * nodeArrayMod[node, 0] = weighted_pos[0]/weights # <<<<<<<<<<<<<<
17340  * nodeArrayMod[node, 1] = weighted_pos[1]/weights
17341  * nodeArrayMod[node, 2] = weighted_pos[2]/weights
17342  */
17343  __pyx_t_26 = __pyx_v_node;
17344  __pyx_t_27 = 0;
17345  if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_nodeArrayMod.shape[0];
17346  if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_nodeArrayMod.shape[1];
17347  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArrayMod.data + __pyx_t_26 * __pyx_v_nodeArrayMod.strides[0]) ) + __pyx_t_27 * __pyx_v_nodeArrayMod.strides[1]) )) = ((__pyx_v_weighted_pos[0]) / __pyx_v_weights);
17348 
17349  /* "mprans/MeshSmoothing.pyx":1150
17350  * weights += weight
17351  * nodeArrayMod[node, 0] = weighted_pos[0]/weights
17352  * nodeArrayMod[node, 1] = weighted_pos[1]/weights # <<<<<<<<<<<<<<
17353  * nodeArrayMod[node, 2] = weighted_pos[2]/weights
17354  * disp[node, 0] = disp[node, 0]-nodeArray[node, 0]
17355  */
17356  __pyx_t_28 = __pyx_v_node;
17357  __pyx_t_29 = 1;
17358  if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_nodeArrayMod.shape[0];
17359  if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_nodeArrayMod.shape[1];
17360  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArrayMod.data + __pyx_t_28 * __pyx_v_nodeArrayMod.strides[0]) ) + __pyx_t_29 * __pyx_v_nodeArrayMod.strides[1]) )) = ((__pyx_v_weighted_pos[1]) / __pyx_v_weights);
17361 
17362  /* "mprans/MeshSmoothing.pyx":1151
17363  * nodeArrayMod[node, 0] = weighted_pos[0]/weights
17364  * nodeArrayMod[node, 1] = weighted_pos[1]/weights
17365  * nodeArrayMod[node, 2] = weighted_pos[2]/weights # <<<<<<<<<<<<<<
17366  * disp[node, 0] = disp[node, 0]-nodeArray[node, 0]
17367  * disp[node, 1] = disp[node, 1]-nodeArray[node, 1]
17368  */
17369  __pyx_t_30 = __pyx_v_node;
17370  __pyx_t_31 = 2;
17371  if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_nodeArrayMod.shape[0];
17372  if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_nodeArrayMod.shape[1];
17373  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArrayMod.data + __pyx_t_30 * __pyx_v_nodeArrayMod.strides[0]) ) + __pyx_t_31 * __pyx_v_nodeArrayMod.strides[1]) )) = ((__pyx_v_weighted_pos[2]) / __pyx_v_weights);
17374  }
17375 
17376  /* "mprans/MeshSmoothing.pyx":1133
17377  * cdef int iN
17378  * for node in range(nNodes_owned):
17379  * if nodeMaterialTypes[node] == 0: # <<<<<<<<<<<<<<
17380  * weights = 0
17381  * weighted_pos[0] = 0
17382  */
17383  }
17384 
17385  /* "mprans/MeshSmoothing.pyx":1152
17386  * nodeArrayMod[node, 1] = weighted_pos[1]/weights
17387  * nodeArrayMod[node, 2] = weighted_pos[2]/weights
17388  * disp[node, 0] = disp[node, 0]-nodeArray[node, 0] # <<<<<<<<<<<<<<
17389  * disp[node, 1] = disp[node, 1]-nodeArray[node, 1]
17390  * disp[node, 2] = disp[node, 2]-nodeArray[node, 2]
17391  */
17392  __pyx_t_32 = __pyx_v_node;
17393  __pyx_t_33 = 0;
17394  if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_disp.shape[0];
17395  if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_disp.shape[1];
17396  __pyx_t_34 = __pyx_v_node;
17397  __pyx_t_35 = 0;
17398  if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_nodeArray.shape[0];
17399  if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_nodeArray.shape[1];
17400  __pyx_t_36 = __pyx_v_node;
17401  __pyx_t_37 = 0;
17402  if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_disp.shape[0];
17403  if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_disp.shape[1];
17404  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_disp.data + __pyx_t_36 * __pyx_v_disp.strides[0]) ) + __pyx_t_37 * __pyx_v_disp.strides[1]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_disp.data + __pyx_t_32 * __pyx_v_disp.strides[0]) ) + __pyx_t_33 * __pyx_v_disp.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_34 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_35 * __pyx_v_nodeArray.strides[1]) ))));
17405 
17406  /* "mprans/MeshSmoothing.pyx":1153
17407  * nodeArrayMod[node, 2] = weighted_pos[2]/weights
17408  * disp[node, 0] = disp[node, 0]-nodeArray[node, 0]
17409  * disp[node, 1] = disp[node, 1]-nodeArray[node, 1] # <<<<<<<<<<<<<<
17410  * disp[node, 2] = disp[node, 2]-nodeArray[node, 2]
17411  * return disp
17412  */
17413  __pyx_t_38 = __pyx_v_node;
17414  __pyx_t_39 = 1;
17415  if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_disp.shape[0];
17416  if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_v_disp.shape[1];
17417  __pyx_t_40 = __pyx_v_node;
17418  __pyx_t_41 = 1;
17419  if (__pyx_t_40 < 0) __pyx_t_40 += __pyx_v_nodeArray.shape[0];
17420  if (__pyx_t_41 < 0) __pyx_t_41 += __pyx_v_nodeArray.shape[1];
17421  __pyx_t_42 = __pyx_v_node;
17422  __pyx_t_43 = 1;
17423  if (__pyx_t_42 < 0) __pyx_t_42 += __pyx_v_disp.shape[0];
17424  if (__pyx_t_43 < 0) __pyx_t_43 += __pyx_v_disp.shape[1];
17425  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_disp.data + __pyx_t_42 * __pyx_v_disp.strides[0]) ) + __pyx_t_43 * __pyx_v_disp.strides[1]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_disp.data + __pyx_t_38 * __pyx_v_disp.strides[0]) ) + __pyx_t_39 * __pyx_v_disp.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_40 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_41 * __pyx_v_nodeArray.strides[1]) ))));
17426 
17427  /* "mprans/MeshSmoothing.pyx":1154
17428  * disp[node, 0] = disp[node, 0]-nodeArray[node, 0]
17429  * disp[node, 1] = disp[node, 1]-nodeArray[node, 1]
17430  * disp[node, 2] = disp[node, 2]-nodeArray[node, 2] # <<<<<<<<<<<<<<
17431  * return disp
17432  *
17433  */
17434  __pyx_t_44 = __pyx_v_node;
17435  __pyx_t_45 = 2;
17436  if (__pyx_t_44 < 0) __pyx_t_44 += __pyx_v_disp.shape[0];
17437  if (__pyx_t_45 < 0) __pyx_t_45 += __pyx_v_disp.shape[1];
17438  __pyx_t_46 = __pyx_v_node;
17439  __pyx_t_47 = 2;
17440  if (__pyx_t_46 < 0) __pyx_t_46 += __pyx_v_nodeArray.shape[0];
17441  if (__pyx_t_47 < 0) __pyx_t_47 += __pyx_v_nodeArray.shape[1];
17442  __pyx_t_48 = __pyx_v_node;
17443  __pyx_t_49 = 2;
17444  if (__pyx_t_48 < 0) __pyx_t_48 += __pyx_v_disp.shape[0];
17445  if (__pyx_t_49 < 0) __pyx_t_49 += __pyx_v_disp.shape[1];
17446  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_disp.data + __pyx_t_48 * __pyx_v_disp.strides[0]) ) + __pyx_t_49 * __pyx_v_disp.strides[1]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_disp.data + __pyx_t_44 * __pyx_v_disp.strides[0]) ) + __pyx_t_45 * __pyx_v_disp.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_46 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_47 * __pyx_v_nodeArray.strides[1]) ))));
17447  }
17448 
17449  /* "mprans/MeshSmoothing.pyx":1155
17450  * disp[node, 1] = disp[node, 1]-nodeArray[node, 1]
17451  * disp[node, 2] = disp[node, 2]-nodeArray[node, 2]
17452  * return disp # <<<<<<<<<<<<<<
17453  *
17454  * cdef int pyxGetLocalNearestNode(double[:] coords,
17455  */
17456  __PYX_INC_MEMVIEW(&__pyx_v_disp, 0);
17457  __pyx_r = __pyx_v_disp;
17458  goto __pyx_L0;
17459 
17460  /* "mprans/MeshSmoothing.pyx":1108
17461  * return IMR_node
17462  *
17463  * cdef double[:,:] cySmoothNodesQuality(double[:] distortion, # <<<<<<<<<<<<<<
17464  * double[:] dilation,
17465  * double[:,:] nodeArray,
17466  */
17467 
17468  /* function exit code */
17469  __pyx_L1_error:;
17470  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
17471  __pyx_r.data = NULL;
17472  __pyx_r.memview = NULL;
17473  __Pyx_AddTraceback("mprans.MeshSmoothing.cySmoothNodesQuality", __pyx_clineno, __pyx_lineno, __pyx_filename);
17474  goto __pyx_L2;
17475  __pyx_L0:;
17476  if (unlikely(!__pyx_r.memview)) {
17477  PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
17478  }
17479  __pyx_L2:;
17480  __PYX_XDEC_MEMVIEW(&__pyx_v_disp, 1);
17481  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArrayMod, 1);
17482  __Pyx_RefNannyFinishContext();
17483  return __pyx_r;
17484 }
17485 
17486 /* "mprans/MeshSmoothing.pyx":1157
17487  * return disp
17488  *
17489  * cdef int pyxGetLocalNearestNode(double[:] coords, # <<<<<<<<<<<<<<
17490  * double[:,:] nodeArray,
17491  * int[:] nodeStarOffsets,
17492  */
17493 
17494 static int __pyx_f_6mprans_13MeshSmoothing_pyxGetLocalNearestNode(__Pyx_memviewslice __pyx_v_coords, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_nodeStarOffsets, __Pyx_memviewslice __pyx_v_nodeStarArray, int __pyx_v_node) {
17495  int __pyx_v_nearest_node;
17496  int __pyx_v_nearest_node0;
17497  double __pyx_v_dist;
17498  double __pyx_v_min_dist;
17499  __Pyx_memviewslice __pyx_v_node_coords = { 0, 0, { 0 }, { 0 }, { 0 } };
17500  bool __pyx_v_found_node;
17501  int __pyx_v_i;
17502  int __pyx_v_nOffset;
17503  int __pyx_r;
17504  __Pyx_RefNannyDeclarations
17505  __Pyx_memviewslice __pyx_t_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
17506  Py_ssize_t __pyx_t_2;
17507  Py_ssize_t __pyx_t_3;
17508  Py_ssize_t __pyx_t_4;
17509  Py_ssize_t __pyx_t_5;
17510  Py_ssize_t __pyx_t_6;
17511  Py_ssize_t __pyx_t_7;
17512  Py_ssize_t __pyx_t_8;
17513  Py_ssize_t __pyx_t_9;
17514  Py_ssize_t __pyx_t_10;
17515  Py_ssize_t __pyx_t_11;
17516  Py_ssize_t __pyx_t_12;
17517  Py_ssize_t __pyx_t_13;
17518  int __pyx_t_14;
17519  Py_ssize_t __pyx_t_15;
17520  int __pyx_t_16;
17521  Py_ssize_t __pyx_t_17;
17522  int __pyx_t_18;
17523  int __pyx_t_19;
17524  Py_ssize_t __pyx_t_20;
17525  Py_ssize_t __pyx_t_21;
17526  Py_ssize_t __pyx_t_22;
17527  Py_ssize_t __pyx_t_23;
17528  Py_ssize_t __pyx_t_24;
17529  Py_ssize_t __pyx_t_25;
17530  Py_ssize_t __pyx_t_26;
17531  Py_ssize_t __pyx_t_27;
17532  Py_ssize_t __pyx_t_28;
17533  Py_ssize_t __pyx_t_29;
17534  Py_ssize_t __pyx_t_30;
17535  Py_ssize_t __pyx_t_31;
17536  Py_ssize_t __pyx_t_32;
17537  __Pyx_RefNannySetupContext("pyxGetLocalNearestNode", 0);
17538 
17539  /* "mprans/MeshSmoothing.pyx":1163
17540  * int node):
17541  * # determine local nearest node distance
17542  * cdef int nearest_node = node # <<<<<<<<<<<<<<
17543  * cdef int nearest_node0 = node
17544  * cdef double dist
17545  */
17546  __pyx_v_nearest_node = __pyx_v_node;
17547 
17548  /* "mprans/MeshSmoothing.pyx":1164
17549  * # determine local nearest node distance
17550  * cdef int nearest_node = node
17551  * cdef int nearest_node0 = node # <<<<<<<<<<<<<<
17552  * cdef double dist
17553  * cdef double min_dist
17554  */
17555  __pyx_v_nearest_node0 = __pyx_v_node;
17556 
17557  /* "mprans/MeshSmoothing.pyx":1167
17558  * cdef double dist
17559  * cdef double min_dist
17560  * cdef double[:] node_coords = nodeArray[nearest_node] # <<<<<<<<<<<<<<
17561  * cdef bool found_node = False
17562  * min_dist = (node_coords[0]-coords[0])*(node_coords[0]-coords[0])+\
17563  */
17564  __pyx_t_1.data = __pyx_v_nodeArray.data;
17565  __pyx_t_1.memview = __pyx_v_nodeArray.memview;
17566  __PYX_INC_MEMVIEW(&__pyx_t_1, 0);
17567  {
17568  Py_ssize_t __pyx_tmp_idx = __pyx_v_nearest_node;
17569  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
17570  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
17571  if (__pyx_tmp_idx < 0)
17572  __pyx_tmp_idx += __pyx_tmp_shape;
17573  if ((0)) __PYX_ERR(0, 1167, __pyx_L1_error)
17574  __pyx_t_1.data += __pyx_tmp_idx * __pyx_tmp_stride;
17575 }
17576 
17577 __pyx_t_1.shape[0] = __pyx_v_nodeArray.shape[1];
17578 __pyx_t_1.strides[0] = __pyx_v_nodeArray.strides[1];
17579  __pyx_t_1.suboffsets[0] = -1;
17580 
17581 __pyx_v_node_coords = __pyx_t_1;
17582  __pyx_t_1.memview = NULL;
17583  __pyx_t_1.data = NULL;
17584 
17585  /* "mprans/MeshSmoothing.pyx":1168
17586  * cdef double min_dist
17587  * cdef double[:] node_coords = nodeArray[nearest_node]
17588  * cdef bool found_node = False # <<<<<<<<<<<<<<
17589  * min_dist = (node_coords[0]-coords[0])*(node_coords[0]-coords[0])+\
17590  * (node_coords[1]-coords[1])*(node_coords[1]-coords[1])+\
17591  */
17592  __pyx_v_found_node = 0;
17593 
17594  /* "mprans/MeshSmoothing.pyx":1169
17595  * cdef double[:] node_coords = nodeArray[nearest_node]
17596  * cdef bool found_node = False
17597  * min_dist = (node_coords[0]-coords[0])*(node_coords[0]-coords[0])+\ # <<<<<<<<<<<<<<
17598  * (node_coords[1]-coords[1])*(node_coords[1]-coords[1])+\
17599  * (node_coords[2]-coords[2])*(node_coords[2]-coords[2])
17600  */
17601  __pyx_t_2 = 0;
17602  if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_node_coords.shape[0];
17603  __pyx_t_3 = 0;
17604  if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_coords.shape[0];
17605  __pyx_t_4 = 0;
17606  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_node_coords.shape[0];
17607  __pyx_t_5 = 0;
17608  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_coords.shape[0];
17609 
17610  /* "mprans/MeshSmoothing.pyx":1170
17611  * cdef bool found_node = False
17612  * min_dist = (node_coords[0]-coords[0])*(node_coords[0]-coords[0])+\
17613  * (node_coords[1]-coords[1])*(node_coords[1]-coords[1])+\ # <<<<<<<<<<<<<<
17614  * (node_coords[2]-coords[2])*(node_coords[2]-coords[2])
17615  * cdef int i = 0
17616  */
17617  __pyx_t_6 = 1;
17618  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_node_coords.shape[0];
17619  __pyx_t_7 = 1;
17620  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coords.shape[0];
17621  __pyx_t_8 = 1;
17622  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_node_coords.shape[0];
17623  __pyx_t_9 = 1;
17624  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coords.shape[0];
17625 
17626  /* "mprans/MeshSmoothing.pyx":1171
17627  * min_dist = (node_coords[0]-coords[0])*(node_coords[0]-coords[0])+\
17628  * (node_coords[1]-coords[1])*(node_coords[1]-coords[1])+\
17629  * (node_coords[2]-coords[2])*(node_coords[2]-coords[2]) # <<<<<<<<<<<<<<
17630  * cdef int i = 0
17631  * cdef int nOffset
17632  */
17633  __pyx_t_10 = 2;
17634  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_node_coords.shape[0];
17635  __pyx_t_11 = 2;
17636  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coords.shape[0];
17637  __pyx_t_12 = 2;
17638  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_node_coords.shape[0];
17639  __pyx_t_13 = 2;
17640  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coords.shape[0];
17641 
17642  /* "mprans/MeshSmoothing.pyx":1170
17643  * cdef bool found_node = False
17644  * min_dist = (node_coords[0]-coords[0])*(node_coords[0]-coords[0])+\
17645  * (node_coords[1]-coords[1])*(node_coords[1]-coords[1])+\ # <<<<<<<<<<<<<<
17646  * (node_coords[2]-coords[2])*(node_coords[2]-coords[2])
17647  * cdef int i = 0
17648  */
17649  __pyx_v_min_dist = (((((*((double *) ( /* dim=0 */ (__pyx_v_node_coords.data + __pyx_t_2 * __pyx_v_node_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_3 * __pyx_v_coords.strides[0]) )))) * ((*((double *) ( /* dim=0 */ (__pyx_v_node_coords.data + __pyx_t_4 * __pyx_v_node_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_5 * __pyx_v_coords.strides[0]) ))))) + (((*((double *) ( /* dim=0 */ (__pyx_v_node_coords.data + __pyx_t_6 * __pyx_v_node_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_7 * __pyx_v_coords.strides[0]) )))) * ((*((double *) ( /* dim=0 */ (__pyx_v_node_coords.data + __pyx_t_8 * __pyx_v_node_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_9 * __pyx_v_coords.strides[0]) )))))) + (((*((double *) ( /* dim=0 */ (__pyx_v_node_coords.data + __pyx_t_10 * __pyx_v_node_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_11 * __pyx_v_coords.strides[0]) )))) * ((*((double *) ( /* dim=0 */ (__pyx_v_node_coords.data + __pyx_t_12 * __pyx_v_node_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_13 * __pyx_v_coords.strides[0]) ))))));
17650 
17651  /* "mprans/MeshSmoothing.pyx":1172
17652  * (node_coords[1]-coords[1])*(node_coords[1]-coords[1])+\
17653  * (node_coords[2]-coords[2])*(node_coords[2]-coords[2])
17654  * cdef int i = 0 # <<<<<<<<<<<<<<
17655  * cdef int nOffset
17656  * while found_node is False:
17657  */
17658  __pyx_v_i = 0;
17659 
17660  /* "mprans/MeshSmoothing.pyx":1174
17661  * cdef int i = 0
17662  * cdef int nOffset
17663  * while found_node is False: # <<<<<<<<<<<<<<
17664  * nearest_node0 = nearest_node
17665  * for nOffset in range(nodeStarOffsets[nearest_node0],
17666  */
17667  while (1) {
17668  __pyx_t_14 = ((__pyx_v_found_node == 0) != 0);
17669  if (!__pyx_t_14) break;
17670 
17671  /* "mprans/MeshSmoothing.pyx":1175
17672  * cdef int nOffset
17673  * while found_node is False:
17674  * nearest_node0 = nearest_node # <<<<<<<<<<<<<<
17675  * for nOffset in range(nodeStarOffsets[nearest_node0],
17676  * nodeStarOffsets[nearest_node0+1]):
17677  */
17678  __pyx_v_nearest_node0 = __pyx_v_nearest_node;
17679 
17680  /* "mprans/MeshSmoothing.pyx":1177
17681  * nearest_node0 = nearest_node
17682  * for nOffset in range(nodeStarOffsets[nearest_node0],
17683  * nodeStarOffsets[nearest_node0+1]): # <<<<<<<<<<<<<<
17684  * node = nodeStarArray[nOffset]
17685  * node_coords = nodeArray[node]
17686  */
17687  __pyx_t_15 = (__pyx_v_nearest_node0 + 1);
17688  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_nodeStarOffsets.shape[0];
17689  __pyx_t_16 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarOffsets.data + __pyx_t_15 * __pyx_v_nodeStarOffsets.strides[0]) )));
17690 
17691  /* "mprans/MeshSmoothing.pyx":1176
17692  * while found_node is False:
17693  * nearest_node0 = nearest_node
17694  * for nOffset in range(nodeStarOffsets[nearest_node0], # <<<<<<<<<<<<<<
17695  * nodeStarOffsets[nearest_node0+1]):
17696  * node = nodeStarArray[nOffset]
17697  */
17698  __pyx_t_17 = __pyx_v_nearest_node0;
17699  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_nodeStarOffsets.shape[0];
17700 
17701  /* "mprans/MeshSmoothing.pyx":1177
17702  * nearest_node0 = nearest_node
17703  * for nOffset in range(nodeStarOffsets[nearest_node0],
17704  * nodeStarOffsets[nearest_node0+1]): # <<<<<<<<<<<<<<
17705  * node = nodeStarArray[nOffset]
17706  * node_coords = nodeArray[node]
17707  */
17708  __pyx_t_18 = __pyx_t_16;
17709  for (__pyx_t_19 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarOffsets.data + __pyx_t_17 * __pyx_v_nodeStarOffsets.strides[0]) ))); __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
17710 
17711  /* "mprans/MeshSmoothing.pyx":1176
17712  * while found_node is False:
17713  * nearest_node0 = nearest_node
17714  * for nOffset in range(nodeStarOffsets[nearest_node0], # <<<<<<<<<<<<<<
17715  * nodeStarOffsets[nearest_node0+1]):
17716  * node = nodeStarArray[nOffset]
17717  */
17718  __pyx_v_nOffset = __pyx_t_19;
17719 
17720  /* "mprans/MeshSmoothing.pyx":1178
17721  * for nOffset in range(nodeStarOffsets[nearest_node0],
17722  * nodeStarOffsets[nearest_node0+1]):
17723  * node = nodeStarArray[nOffset] # <<<<<<<<<<<<<<
17724  * node_coords = nodeArray[node]
17725  * dist = (node_coords[0]-coords[0])*(node_coords[0]-coords[0])+\
17726  */
17727  __pyx_t_20 = __pyx_v_nOffset;
17728  if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_nodeStarArray.shape[0];
17729  __pyx_v_node = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_20 * __pyx_v_nodeStarArray.strides[0]) )));
17730 
17731  /* "mprans/MeshSmoothing.pyx":1179
17732  * nodeStarOffsets[nearest_node0+1]):
17733  * node = nodeStarArray[nOffset]
17734  * node_coords = nodeArray[node] # <<<<<<<<<<<<<<
17735  * dist = (node_coords[0]-coords[0])*(node_coords[0]-coords[0])+\
17736  * (node_coords[1]-coords[1])*(node_coords[1]-coords[1])+\
17737  */
17738  __pyx_t_1.data = __pyx_v_nodeArray.data;
17739  __pyx_t_1.memview = __pyx_v_nodeArray.memview;
17740  __PYX_INC_MEMVIEW(&__pyx_t_1, 0);
17741  {
17742  Py_ssize_t __pyx_tmp_idx = __pyx_v_node;
17743  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
17744  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
17745  if (__pyx_tmp_idx < 0)
17746  __pyx_tmp_idx += __pyx_tmp_shape;
17747  if ((0)) __PYX_ERR(0, 1179, __pyx_L1_error)
17748  __pyx_t_1.data += __pyx_tmp_idx * __pyx_tmp_stride;
17749 }
17750 
17751 __pyx_t_1.shape[0] = __pyx_v_nodeArray.shape[1];
17752 __pyx_t_1.strides[0] = __pyx_v_nodeArray.strides[1];
17753  __pyx_t_1.suboffsets[0] = -1;
17754 
17755 __PYX_XDEC_MEMVIEW(&__pyx_v_node_coords, 1);
17756  __pyx_v_node_coords = __pyx_t_1;
17757  __pyx_t_1.memview = NULL;
17758  __pyx_t_1.data = NULL;
17759 
17760  /* "mprans/MeshSmoothing.pyx":1180
17761  * node = nodeStarArray[nOffset]
17762  * node_coords = nodeArray[node]
17763  * dist = (node_coords[0]-coords[0])*(node_coords[0]-coords[0])+\ # <<<<<<<<<<<<<<
17764  * (node_coords[1]-coords[1])*(node_coords[1]-coords[1])+\
17765  * (node_coords[2]-coords[2])*(node_coords[2]-coords[2])
17766  */
17767  __pyx_t_21 = 0;
17768  if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_node_coords.shape[0];
17769  __pyx_t_22 = 0;
17770  if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_coords.shape[0];
17771  __pyx_t_23 = 0;
17772  if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_node_coords.shape[0];
17773  __pyx_t_24 = 0;
17774  if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_coords.shape[0];
17775 
17776  /* "mprans/MeshSmoothing.pyx":1181
17777  * node_coords = nodeArray[node]
17778  * dist = (node_coords[0]-coords[0])*(node_coords[0]-coords[0])+\
17779  * (node_coords[1]-coords[1])*(node_coords[1]-coords[1])+\ # <<<<<<<<<<<<<<
17780  * (node_coords[2]-coords[2])*(node_coords[2]-coords[2])
17781  * if dist < min_dist:
17782  */
17783  __pyx_t_25 = 1;
17784  if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_node_coords.shape[0];
17785  __pyx_t_26 = 1;
17786  if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_coords.shape[0];
17787  __pyx_t_27 = 1;
17788  if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_node_coords.shape[0];
17789  __pyx_t_28 = 1;
17790  if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_coords.shape[0];
17791 
17792  /* "mprans/MeshSmoothing.pyx":1182
17793  * dist = (node_coords[0]-coords[0])*(node_coords[0]-coords[0])+\
17794  * (node_coords[1]-coords[1])*(node_coords[1]-coords[1])+\
17795  * (node_coords[2]-coords[2])*(node_coords[2]-coords[2]) # <<<<<<<<<<<<<<
17796  * if dist < min_dist:
17797  * min_dist = dist
17798  */
17799  __pyx_t_29 = 2;
17800  if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_node_coords.shape[0];
17801  __pyx_t_30 = 2;
17802  if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_coords.shape[0];
17803  __pyx_t_31 = 2;
17804  if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_node_coords.shape[0];
17805  __pyx_t_32 = 2;
17806  if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_coords.shape[0];
17807 
17808  /* "mprans/MeshSmoothing.pyx":1181
17809  * node_coords = nodeArray[node]
17810  * dist = (node_coords[0]-coords[0])*(node_coords[0]-coords[0])+\
17811  * (node_coords[1]-coords[1])*(node_coords[1]-coords[1])+\ # <<<<<<<<<<<<<<
17812  * (node_coords[2]-coords[2])*(node_coords[2]-coords[2])
17813  * if dist < min_dist:
17814  */
17815  __pyx_v_dist = (((((*((double *) ( /* dim=0 */ (__pyx_v_node_coords.data + __pyx_t_21 * __pyx_v_node_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_22 * __pyx_v_coords.strides[0]) )))) * ((*((double *) ( /* dim=0 */ (__pyx_v_node_coords.data + __pyx_t_23 * __pyx_v_node_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_24 * __pyx_v_coords.strides[0]) ))))) + (((*((double *) ( /* dim=0 */ (__pyx_v_node_coords.data + __pyx_t_25 * __pyx_v_node_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_26 * __pyx_v_coords.strides[0]) )))) * ((*((double *) ( /* dim=0 */ (__pyx_v_node_coords.data + __pyx_t_27 * __pyx_v_node_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_28 * __pyx_v_coords.strides[0]) )))))) + (((*((double *) ( /* dim=0 */ (__pyx_v_node_coords.data + __pyx_t_29 * __pyx_v_node_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_30 * __pyx_v_coords.strides[0]) )))) * ((*((double *) ( /* dim=0 */ (__pyx_v_node_coords.data + __pyx_t_31 * __pyx_v_node_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_32 * __pyx_v_coords.strides[0]) ))))));
17816 
17817  /* "mprans/MeshSmoothing.pyx":1183
17818  * (node_coords[1]-coords[1])*(node_coords[1]-coords[1])+\
17819  * (node_coords[2]-coords[2])*(node_coords[2]-coords[2])
17820  * if dist < min_dist: # <<<<<<<<<<<<<<
17821  * min_dist = dist
17822  * nearest_node = node
17823  */
17824  __pyx_t_14 = ((__pyx_v_dist < __pyx_v_min_dist) != 0);
17825  if (__pyx_t_14) {
17826 
17827  /* "mprans/MeshSmoothing.pyx":1184
17828  * (node_coords[2]-coords[2])*(node_coords[2]-coords[2])
17829  * if dist < min_dist:
17830  * min_dist = dist # <<<<<<<<<<<<<<
17831  * nearest_node = node
17832  * if nearest_node0 == nearest_node:
17833  */
17834  __pyx_v_min_dist = __pyx_v_dist;
17835 
17836  /* "mprans/MeshSmoothing.pyx":1185
17837  * if dist < min_dist:
17838  * min_dist = dist
17839  * nearest_node = node # <<<<<<<<<<<<<<
17840  * if nearest_node0 == nearest_node:
17841  * found_node = True
17842  */
17843  __pyx_v_nearest_node = __pyx_v_node;
17844 
17845  /* "mprans/MeshSmoothing.pyx":1183
17846  * (node_coords[1]-coords[1])*(node_coords[1]-coords[1])+\
17847  * (node_coords[2]-coords[2])*(node_coords[2]-coords[2])
17848  * if dist < min_dist: # <<<<<<<<<<<<<<
17849  * min_dist = dist
17850  * nearest_node = node
17851  */
17852  }
17853  }
17854 
17855  /* "mprans/MeshSmoothing.pyx":1186
17856  * min_dist = dist
17857  * nearest_node = node
17858  * if nearest_node0 == nearest_node: # <<<<<<<<<<<<<<
17859  * found_node = True
17860  * i += 1
17861  */
17862  __pyx_t_14 = ((__pyx_v_nearest_node0 == __pyx_v_nearest_node) != 0);
17863  if (__pyx_t_14) {
17864 
17865  /* "mprans/MeshSmoothing.pyx":1187
17866  * nearest_node = node
17867  * if nearest_node0 == nearest_node:
17868  * found_node = True # <<<<<<<<<<<<<<
17869  * i += 1
17870  * return nearest_node
17871  */
17872  __pyx_v_found_node = 1;
17873 
17874  /* "mprans/MeshSmoothing.pyx":1186
17875  * min_dist = dist
17876  * nearest_node = node
17877  * if nearest_node0 == nearest_node: # <<<<<<<<<<<<<<
17878  * found_node = True
17879  * i += 1
17880  */
17881  }
17882 
17883  /* "mprans/MeshSmoothing.pyx":1188
17884  * if nearest_node0 == nearest_node:
17885  * found_node = True
17886  * i += 1 # <<<<<<<<<<<<<<
17887  * return nearest_node
17888  *
17889  */
17890  __pyx_v_i = (__pyx_v_i + 1);
17891  }
17892 
17893  /* "mprans/MeshSmoothing.pyx":1189
17894  * found_node = True
17895  * i += 1
17896  * return nearest_node # <<<<<<<<<<<<<<
17897  *
17898  *
17899  */
17900  __pyx_r = __pyx_v_nearest_node;
17901  goto __pyx_L0;
17902 
17903  /* "mprans/MeshSmoothing.pyx":1157
17904  * return disp
17905  *
17906  * cdef int pyxGetLocalNearestNode(double[:] coords, # <<<<<<<<<<<<<<
17907  * double[:,:] nodeArray,
17908  * int[:] nodeStarOffsets,
17909  */
17910 
17911  /* function exit code */
17912  __pyx_L1_error:;
17913  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
17914  __Pyx_WriteUnraisable("mprans.MeshSmoothing.pyxGetLocalNearestNode", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
17915  __pyx_r = 0;
17916  __pyx_L0:;
17917  __PYX_XDEC_MEMVIEW(&__pyx_v_node_coords, 1);
17918  __Pyx_RefNannyFinishContext();
17919  return __pyx_r;
17920 }
17921 
17922 /* "mprans/MeshSmoothing.pyx":1192
17923  *
17924  *
17925  * cdef int pyxGetLocalNearestElement(double[:] coords, # <<<<<<<<<<<<<<
17926  * double[:,:] elementBarycentersArray,
17927  * int[:,:] elementNeighborsArray,
17928  */
17929 
17930 static int __pyx_f_6mprans_13MeshSmoothing_pyxGetLocalNearestElement(__Pyx_memviewslice __pyx_v_coords, __Pyx_memviewslice __pyx_v_elementBarycentersArray, __Pyx_memviewslice __pyx_v_elementNeighborsArray, int __pyx_v_eN) {
17931  int __pyx_v_nearest_eN;
17932  int __pyx_v_nearest_eN0;
17933  double __pyx_v_dist;
17934  double __pyx_v_min_dist;
17935  double __pyx_v_eN_coords[3];
17936  bool __pyx_v_found_eN;
17937  int __pyx_v_eN_;
17938  int __pyx_v_nEneig;
17939  int __pyx_v_iEn;
17940  int __pyx_v_i;
17941  int __pyx_r;
17942  __Pyx_RefNannyDeclarations
17943  Py_ssize_t __pyx_t_1;
17944  Py_ssize_t __pyx_t_2;
17945  Py_ssize_t __pyx_t_3;
17946  Py_ssize_t __pyx_t_4;
17947  Py_ssize_t __pyx_t_5;
17948  Py_ssize_t __pyx_t_6;
17949  Py_ssize_t __pyx_t_7;
17950  Py_ssize_t __pyx_t_8;
17951  Py_ssize_t __pyx_t_9;
17952  Py_ssize_t __pyx_t_10;
17953  Py_ssize_t __pyx_t_11;
17954  Py_ssize_t __pyx_t_12;
17955  int __pyx_t_13;
17956  int __pyx_t_14;
17957  int __pyx_t_15;
17958  int __pyx_t_16;
17959  Py_ssize_t __pyx_t_17;
17960  Py_ssize_t __pyx_t_18;
17961  Py_ssize_t __pyx_t_19;
17962  Py_ssize_t __pyx_t_20;
17963  Py_ssize_t __pyx_t_21;
17964  Py_ssize_t __pyx_t_22;
17965  Py_ssize_t __pyx_t_23;
17966  Py_ssize_t __pyx_t_24;
17967  Py_ssize_t __pyx_t_25;
17968  Py_ssize_t __pyx_t_26;
17969  Py_ssize_t __pyx_t_27;
17970  Py_ssize_t __pyx_t_28;
17971  Py_ssize_t __pyx_t_29;
17972  Py_ssize_t __pyx_t_30;
17973  __Pyx_RefNannySetupContext("pyxGetLocalNearestElement", 0);
17974 
17975  /* "mprans/MeshSmoothing.pyx":1197
17976  * int eN):
17977  * # determine local nearest node distance
17978  * cdef int nearest_eN = eN # <<<<<<<<<<<<<<
17979  * cdef int nearest_eN0 = eN
17980  * cdef double dist
17981  */
17982  __pyx_v_nearest_eN = __pyx_v_eN;
17983 
17984  /* "mprans/MeshSmoothing.pyx":1198
17985  * # determine local nearest node distance
17986  * cdef int nearest_eN = eN
17987  * cdef int nearest_eN0 = eN # <<<<<<<<<<<<<<
17988  * cdef double dist
17989  * cdef double min_dist
17990  */
17991  __pyx_v_nearest_eN0 = __pyx_v_eN;
17992 
17993  /* "mprans/MeshSmoothing.pyx":1202
17994  * cdef double min_dist
17995  * cdef double[3] eN_coords
17996  * cdef bool found_eN = False # <<<<<<<<<<<<<<
17997  * cdef int nOffset
17998  * cdef int eN_
17999  */
18000  __pyx_v_found_eN = 0;
18001 
18002  /* "mprans/MeshSmoothing.pyx":1205
18003  * cdef int nOffset
18004  * cdef int eN_
18005  * eN_coords[0] = elementBarycentersArray[eN, 0] # <<<<<<<<<<<<<<
18006  * eN_coords[1] = elementBarycentersArray[eN, 1]
18007  * eN_coords[2] = elementBarycentersArray[eN, 2]
18008  */
18009  __pyx_t_1 = __pyx_v_eN;
18010  __pyx_t_2 = 0;
18011  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_elementBarycentersArray.shape[0];
18012  if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_elementBarycentersArray.shape[1];
18013  (__pyx_v_eN_coords[0]) = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray.data + __pyx_t_1 * __pyx_v_elementBarycentersArray.strides[0]) ) + __pyx_t_2 * __pyx_v_elementBarycentersArray.strides[1]) )));
18014 
18015  /* "mprans/MeshSmoothing.pyx":1206
18016  * cdef int eN_
18017  * eN_coords[0] = elementBarycentersArray[eN, 0]
18018  * eN_coords[1] = elementBarycentersArray[eN, 1] # <<<<<<<<<<<<<<
18019  * eN_coords[2] = elementBarycentersArray[eN, 2]
18020  * cdef int nEneig = elementNeighborsArray.shape[1]
18021  */
18022  __pyx_t_3 = __pyx_v_eN;
18023  __pyx_t_4 = 1;
18024  if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_elementBarycentersArray.shape[0];
18025  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_elementBarycentersArray.shape[1];
18026  (__pyx_v_eN_coords[1]) = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray.data + __pyx_t_3 * __pyx_v_elementBarycentersArray.strides[0]) ) + __pyx_t_4 * __pyx_v_elementBarycentersArray.strides[1]) )));
18027 
18028  /* "mprans/MeshSmoothing.pyx":1207
18029  * eN_coords[0] = elementBarycentersArray[eN, 0]
18030  * eN_coords[1] = elementBarycentersArray[eN, 1]
18031  * eN_coords[2] = elementBarycentersArray[eN, 2] # <<<<<<<<<<<<<<
18032  * cdef int nEneig = elementNeighborsArray.shape[1]
18033  * cdef int iEn
18034  */
18035  __pyx_t_5 = __pyx_v_eN;
18036  __pyx_t_6 = 2;
18037  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBarycentersArray.shape[0];
18038  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_elementBarycentersArray.shape[1];
18039  (__pyx_v_eN_coords[2]) = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray.data + __pyx_t_5 * __pyx_v_elementBarycentersArray.strides[0]) ) + __pyx_t_6 * __pyx_v_elementBarycentersArray.strides[1]) )));
18040 
18041  /* "mprans/MeshSmoothing.pyx":1208
18042  * eN_coords[1] = elementBarycentersArray[eN, 1]
18043  * eN_coords[2] = elementBarycentersArray[eN, 2]
18044  * cdef int nEneig = elementNeighborsArray.shape[1] # <<<<<<<<<<<<<<
18045  * cdef int iEn
18046  * min_dist = (eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
18047  */
18048  __pyx_v_nEneig = (__pyx_v_elementNeighborsArray.shape[1]);
18049 
18050  /* "mprans/MeshSmoothing.pyx":1210
18051  * cdef int nEneig = elementNeighborsArray.shape[1]
18052  * cdef int iEn
18053  * min_dist = (eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\ # <<<<<<<<<<<<<<
18054  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\
18055  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])
18056  */
18057  __pyx_t_7 = 0;
18058  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coords.shape[0];
18059  __pyx_t_8 = 0;
18060  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coords.shape[0];
18061 
18062  /* "mprans/MeshSmoothing.pyx":1211
18063  * cdef int iEn
18064  * min_dist = (eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
18065  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\ # <<<<<<<<<<<<<<
18066  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])
18067  * cdef int i = 0
18068  */
18069  __pyx_t_9 = 1;
18070  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coords.shape[0];
18071  __pyx_t_10 = 1;
18072  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coords.shape[0];
18073 
18074  /* "mprans/MeshSmoothing.pyx":1212
18075  * min_dist = (eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
18076  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\
18077  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2]) # <<<<<<<<<<<<<<
18078  * cdef int i = 0
18079  * while found_eN is False:
18080  */
18081  __pyx_t_11 = 2;
18082  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coords.shape[0];
18083  __pyx_t_12 = 2;
18084  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coords.shape[0];
18085 
18086  /* "mprans/MeshSmoothing.pyx":1211
18087  * cdef int iEn
18088  * min_dist = (eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
18089  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\ # <<<<<<<<<<<<<<
18090  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])
18091  * cdef int i = 0
18092  */
18093  __pyx_v_min_dist = (((((__pyx_v_eN_coords[0]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_7 * __pyx_v_coords.strides[0]) )))) * ((__pyx_v_eN_coords[0]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_8 * __pyx_v_coords.strides[0]) ))))) + (((__pyx_v_eN_coords[1]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_9 * __pyx_v_coords.strides[0]) )))) * ((__pyx_v_eN_coords[1]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_10 * __pyx_v_coords.strides[0]) )))))) + (((__pyx_v_eN_coords[2]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_11 * __pyx_v_coords.strides[0]) )))) * ((__pyx_v_eN_coords[2]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_12 * __pyx_v_coords.strides[0]) ))))));
18094 
18095  /* "mprans/MeshSmoothing.pyx":1213
18096  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\
18097  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])
18098  * cdef int i = 0 # <<<<<<<<<<<<<<
18099  * while found_eN is False:
18100  * nearest_eN0 = nearest_eN
18101  */
18102  __pyx_v_i = 0;
18103 
18104  /* "mprans/MeshSmoothing.pyx":1214
18105  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])
18106  * cdef int i = 0
18107  * while found_eN is False: # <<<<<<<<<<<<<<
18108  * nearest_eN0 = nearest_eN
18109  *
18110  */
18111  while (1) {
18112  __pyx_t_13 = ((__pyx_v_found_eN == 0) != 0);
18113  if (!__pyx_t_13) break;
18114 
18115  /* "mprans/MeshSmoothing.pyx":1215
18116  * cdef int i = 0
18117  * while found_eN is False:
18118  * nearest_eN0 = nearest_eN # <<<<<<<<<<<<<<
18119  *
18120  * for iEn in range(nEneig):
18121  */
18122  __pyx_v_nearest_eN0 = __pyx_v_nearest_eN;
18123 
18124  /* "mprans/MeshSmoothing.pyx":1217
18125  * nearest_eN0 = nearest_eN
18126  *
18127  * for iEn in range(nEneig): # <<<<<<<<<<<<<<
18128  * eN_ = elementNeighborsArray[nearest_eN0, iEn]
18129  * eN_coords[0] = elementBarycentersArray[eN_, 0]
18130  */
18131  __pyx_t_14 = __pyx_v_nEneig;
18132  __pyx_t_15 = __pyx_t_14;
18133  for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
18134  __pyx_v_iEn = __pyx_t_16;
18135 
18136  /* "mprans/MeshSmoothing.pyx":1218
18137  *
18138  * for iEn in range(nEneig):
18139  * eN_ = elementNeighborsArray[nearest_eN0, iEn] # <<<<<<<<<<<<<<
18140  * eN_coords[0] = elementBarycentersArray[eN_, 0]
18141  * eN_coords[1] = elementBarycentersArray[eN_, 1]
18142  */
18143  __pyx_t_17 = __pyx_v_nearest_eN0;
18144  __pyx_t_18 = __pyx_v_iEn;
18145  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_elementNeighborsArray.shape[0];
18146  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_elementNeighborsArray.shape[1];
18147  __pyx_v_eN_ = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNeighborsArray.data + __pyx_t_17 * __pyx_v_elementNeighborsArray.strides[0]) ) + __pyx_t_18 * __pyx_v_elementNeighborsArray.strides[1]) )));
18148 
18149  /* "mprans/MeshSmoothing.pyx":1219
18150  * for iEn in range(nEneig):
18151  * eN_ = elementNeighborsArray[nearest_eN0, iEn]
18152  * eN_coords[0] = elementBarycentersArray[eN_, 0] # <<<<<<<<<<<<<<
18153  * eN_coords[1] = elementBarycentersArray[eN_, 1]
18154  * eN_coords[2] = elementBarycentersArray[eN_, 2]
18155  */
18156  __pyx_t_19 = __pyx_v_eN_;
18157  __pyx_t_20 = 0;
18158  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_elementBarycentersArray.shape[0];
18159  if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_elementBarycentersArray.shape[1];
18160  (__pyx_v_eN_coords[0]) = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray.data + __pyx_t_19 * __pyx_v_elementBarycentersArray.strides[0]) ) + __pyx_t_20 * __pyx_v_elementBarycentersArray.strides[1]) )));
18161 
18162  /* "mprans/MeshSmoothing.pyx":1220
18163  * eN_ = elementNeighborsArray[nearest_eN0, iEn]
18164  * eN_coords[0] = elementBarycentersArray[eN_, 0]
18165  * eN_coords[1] = elementBarycentersArray[eN_, 1] # <<<<<<<<<<<<<<
18166  * eN_coords[2] = elementBarycentersArray[eN_, 2]
18167  * dist = (eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
18168  */
18169  __pyx_t_21 = __pyx_v_eN_;
18170  __pyx_t_22 = 1;
18171  if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_elementBarycentersArray.shape[0];
18172  if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_elementBarycentersArray.shape[1];
18173  (__pyx_v_eN_coords[1]) = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray.data + __pyx_t_21 * __pyx_v_elementBarycentersArray.strides[0]) ) + __pyx_t_22 * __pyx_v_elementBarycentersArray.strides[1]) )));
18174 
18175  /* "mprans/MeshSmoothing.pyx":1221
18176  * eN_coords[0] = elementBarycentersArray[eN_, 0]
18177  * eN_coords[1] = elementBarycentersArray[eN_, 1]
18178  * eN_coords[2] = elementBarycentersArray[eN_, 2] # <<<<<<<<<<<<<<
18179  * dist = (eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
18180  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\
18181  */
18182  __pyx_t_23 = __pyx_v_eN_;
18183  __pyx_t_24 = 2;
18184  if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_elementBarycentersArray.shape[0];
18185  if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_elementBarycentersArray.shape[1];
18186  (__pyx_v_eN_coords[2]) = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray.data + __pyx_t_23 * __pyx_v_elementBarycentersArray.strides[0]) ) + __pyx_t_24 * __pyx_v_elementBarycentersArray.strides[1]) )));
18187 
18188  /* "mprans/MeshSmoothing.pyx":1222
18189  * eN_coords[1] = elementBarycentersArray[eN_, 1]
18190  * eN_coords[2] = elementBarycentersArray[eN_, 2]
18191  * dist = (eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\ # <<<<<<<<<<<<<<
18192  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\
18193  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])
18194  */
18195  __pyx_t_25 = 0;
18196  if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_coords.shape[0];
18197  __pyx_t_26 = 0;
18198  if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_coords.shape[0];
18199 
18200  /* "mprans/MeshSmoothing.pyx":1223
18201  * eN_coords[2] = elementBarycentersArray[eN_, 2]
18202  * dist = (eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
18203  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\ # <<<<<<<<<<<<<<
18204  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])
18205  * if dist < min_dist:
18206  */
18207  __pyx_t_27 = 1;
18208  if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_coords.shape[0];
18209  __pyx_t_28 = 1;
18210  if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_coords.shape[0];
18211 
18212  /* "mprans/MeshSmoothing.pyx":1224
18213  * dist = (eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
18214  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\
18215  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2]) # <<<<<<<<<<<<<<
18216  * if dist < min_dist:
18217  * min_dist = dist
18218  */
18219  __pyx_t_29 = 2;
18220  if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_coords.shape[0];
18221  __pyx_t_30 = 2;
18222  if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_coords.shape[0];
18223 
18224  /* "mprans/MeshSmoothing.pyx":1223
18225  * eN_coords[2] = elementBarycentersArray[eN_, 2]
18226  * dist = (eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
18227  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\ # <<<<<<<<<<<<<<
18228  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])
18229  * if dist < min_dist:
18230  */
18231  __pyx_v_dist = (((((__pyx_v_eN_coords[0]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_25 * __pyx_v_coords.strides[0]) )))) * ((__pyx_v_eN_coords[0]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_26 * __pyx_v_coords.strides[0]) ))))) + (((__pyx_v_eN_coords[1]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_27 * __pyx_v_coords.strides[0]) )))) * ((__pyx_v_eN_coords[1]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_28 * __pyx_v_coords.strides[0]) )))))) + (((__pyx_v_eN_coords[2]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_29 * __pyx_v_coords.strides[0]) )))) * ((__pyx_v_eN_coords[2]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_30 * __pyx_v_coords.strides[0]) ))))));
18232 
18233  /* "mprans/MeshSmoothing.pyx":1225
18234  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\
18235  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])
18236  * if dist < min_dist: # <<<<<<<<<<<<<<
18237  * min_dist = dist
18238  * nearest_eN = eN_
18239  */
18240  __pyx_t_13 = ((__pyx_v_dist < __pyx_v_min_dist) != 0);
18241  if (__pyx_t_13) {
18242 
18243  /* "mprans/MeshSmoothing.pyx":1226
18244  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])
18245  * if dist < min_dist:
18246  * min_dist = dist # <<<<<<<<<<<<<<
18247  * nearest_eN = eN_
18248  * if nearest_eN0 == nearest_eN:
18249  */
18250  __pyx_v_min_dist = __pyx_v_dist;
18251 
18252  /* "mprans/MeshSmoothing.pyx":1227
18253  * if dist < min_dist:
18254  * min_dist = dist
18255  * nearest_eN = eN_ # <<<<<<<<<<<<<<
18256  * if nearest_eN0 == nearest_eN:
18257  * found_eN = True
18258  */
18259  __pyx_v_nearest_eN = __pyx_v_eN_;
18260 
18261  /* "mprans/MeshSmoothing.pyx":1225
18262  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\
18263  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])
18264  * if dist < min_dist: # <<<<<<<<<<<<<<
18265  * min_dist = dist
18266  * nearest_eN = eN_
18267  */
18268  }
18269  }
18270 
18271  /* "mprans/MeshSmoothing.pyx":1228
18272  * min_dist = dist
18273  * nearest_eN = eN_
18274  * if nearest_eN0 == nearest_eN: # <<<<<<<<<<<<<<
18275  * found_eN = True
18276  * i += 1
18277  */
18278  __pyx_t_13 = ((__pyx_v_nearest_eN0 == __pyx_v_nearest_eN) != 0);
18279  if (__pyx_t_13) {
18280 
18281  /* "mprans/MeshSmoothing.pyx":1229
18282  * nearest_eN = eN_
18283  * if nearest_eN0 == nearest_eN:
18284  * found_eN = True # <<<<<<<<<<<<<<
18285  * i += 1
18286  * return nearest_eN
18287  */
18288  __pyx_v_found_eN = 1;
18289 
18290  /* "mprans/MeshSmoothing.pyx":1228
18291  * min_dist = dist
18292  * nearest_eN = eN_
18293  * if nearest_eN0 == nearest_eN: # <<<<<<<<<<<<<<
18294  * found_eN = True
18295  * i += 1
18296  */
18297  }
18298 
18299  /* "mprans/MeshSmoothing.pyx":1230
18300  * if nearest_eN0 == nearest_eN:
18301  * found_eN = True
18302  * i += 1 # <<<<<<<<<<<<<<
18303  * return nearest_eN
18304  *
18305  */
18306  __pyx_v_i = (__pyx_v_i + 1);
18307  }
18308 
18309  /* "mprans/MeshSmoothing.pyx":1231
18310  * found_eN = True
18311  * i += 1
18312  * return nearest_eN # <<<<<<<<<<<<<<
18313  *
18314  * cdef int[:] pyxGetLocalNearestElementIntersection(double[:] coords,
18315  */
18316  __pyx_r = __pyx_v_nearest_eN;
18317  goto __pyx_L0;
18318 
18319  /* "mprans/MeshSmoothing.pyx":1192
18320  *
18321  *
18322  * cdef int pyxGetLocalNearestElement(double[:] coords, # <<<<<<<<<<<<<<
18323  * double[:,:] elementBarycentersArray,
18324  * int[:,:] elementNeighborsArray,
18325  */
18326 
18327  /* function exit code */
18328  __pyx_L0:;
18329  __Pyx_RefNannyFinishContext();
18330  return __pyx_r;
18331 }
18332 
18333 /* "mprans/MeshSmoothing.pyx":1233
18334  * return nearest_eN
18335  *
18336  * cdef int[:] pyxGetLocalNearestElementIntersection(double[:] coords, # <<<<<<<<<<<<<<
18337  * double[:] starting_coords,
18338  * double[:,:,:] elementBoundaryNormalsArray,
18339  */
18340 
18341 static __Pyx_memviewslice __pyx_f_6mprans_13MeshSmoothing_pyxGetLocalNearestElementIntersection(__Pyx_memviewslice __pyx_v_coords, __Pyx_memviewslice __pyx_v_starting_coords, __Pyx_memviewslice __pyx_v_elementBoundaryNormalsArray, __Pyx_memviewslice __pyx_v_elementBoundariesArray, __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray, __Pyx_memviewslice __pyx_v_elementBoundaryElementsArray, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_exteriorElementBoundariesBoolArray, int __pyx_v_eN) {
18342  int __pyx_v_result[2];
18343  double __pyx_v_eN_coords[3];
18344  double __pyx_v_min_dist;
18345  double __pyx_v_direction[3];
18346  int __pyx_v_maxit;
18347  int __pyx_v_nEbn;
18348  int __pyx_v_nearest_eN;
18349  int __pyx_v_nearest_eN0;
18350  bool __pyx_v_found_eN;
18351  int __pyx_v_i;
18352  __Pyx_memviewslice __pyx_v_bound_bar = { 0, 0, { 0 }, { 0 }, { 0 } };
18353  double __pyx_v_alpha;
18354  int __pyx_v_b_i;
18355  int __pyx_v_b_i_last;
18356  __Pyx_memviewslice __pyx_v_normal = { 0, 0, { 0 }, { 0 }, { 0 } };
18357  double __pyx_v_dot;
18358  double __pyx_v_dot2;
18359  int __pyx_v_it;
18360  int __pyx_v_eN_;
18361  int __pyx_v_j;
18362  int __pyx_v_k;
18363  double __pyx_v_alpha_min;
18364  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
18365  __Pyx_RefNannyDeclarations
18366  Py_ssize_t __pyx_t_1;
18367  Py_ssize_t __pyx_t_2;
18368  Py_ssize_t __pyx_t_3;
18369  Py_ssize_t __pyx_t_4;
18370  Py_ssize_t __pyx_t_5;
18371  Py_ssize_t __pyx_t_6;
18372  Py_ssize_t __pyx_t_7;
18373  Py_ssize_t __pyx_t_8;
18374  Py_ssize_t __pyx_t_9;
18375  Py_ssize_t __pyx_t_10;
18376  Py_ssize_t __pyx_t_11;
18377  Py_ssize_t __pyx_t_12;
18378  int __pyx_t_13;
18379  int __pyx_t_14;
18380  int __pyx_t_15;
18381  int __pyx_t_16;
18382  int __pyx_t_17;
18383  Py_ssize_t __pyx_t_18;
18384  Py_ssize_t __pyx_t_19;
18385  __Pyx_memviewslice __pyx_t_20 = { 0, 0, { 0 }, { 0 }, { 0 } };
18386  Py_ssize_t __pyx_t_21;
18387  Py_ssize_t __pyx_t_22;
18388  Py_ssize_t __pyx_t_23;
18389  Py_ssize_t __pyx_t_24;
18390  Py_ssize_t __pyx_t_25;
18391  Py_ssize_t __pyx_t_26;
18392  Py_ssize_t __pyx_t_27;
18393  Py_ssize_t __pyx_t_28;
18394  Py_ssize_t __pyx_t_29;
18395  int __pyx_t_30;
18396  Py_ssize_t __pyx_t_31;
18397  Py_ssize_t __pyx_t_32;
18398  long __pyx_t_33;
18399  PyObject *__pyx_t_34 = NULL;
18400  PyObject *__pyx_t_35 = NULL;
18401  PyObject *__pyx_t_36 = NULL;
18402  Py_ssize_t __pyx_t_37;
18403  Py_ssize_t __pyx_t_38;
18404  Py_ssize_t __pyx_t_39;
18405  struct __pyx_array_obj *__pyx_t_40 = NULL;
18406  __Pyx_memviewslice __pyx_t_41 = { 0, 0, { 0 }, { 0 }, { 0 } };
18407  __Pyx_RefNannySetupContext("pyxGetLocalNearestElementIntersection", 0);
18408 
18409  /* "mprans/MeshSmoothing.pyx":1244
18410  * cdef int[2] result
18411  * # cdef int[:] result = np.zeros(2, dtype=np.int32)
18412  * result[0] = -1 # <<<<<<<<<<<<<<
18413  * result[1] = -1
18414  * cdef double[3] eN_coords
18415  */
18416  (__pyx_v_result[0]) = -1;
18417 
18418  /* "mprans/MeshSmoothing.pyx":1245
18419  * # cdef int[:] result = np.zeros(2, dtype=np.int32)
18420  * result[0] = -1
18421  * result[1] = -1 # <<<<<<<<<<<<<<
18422  * cdef double[3] eN_coords
18423  * eN_coords[0] = starting_coords[0]
18424  */
18425  (__pyx_v_result[1]) = -1;
18426 
18427  /* "mprans/MeshSmoothing.pyx":1247
18428  * result[1] = -1
18429  * cdef double[3] eN_coords
18430  * eN_coords[0] = starting_coords[0] # <<<<<<<<<<<<<<
18431  * eN_coords[1] = starting_coords[1]
18432  * eN_coords[2] = starting_coords[2]
18433  */
18434  __pyx_t_1 = 0;
18435  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_starting_coords.shape[0];
18436  (__pyx_v_eN_coords[0]) = (*((double *) ( /* dim=0 */ (__pyx_v_starting_coords.data + __pyx_t_1 * __pyx_v_starting_coords.strides[0]) )));
18437 
18438  /* "mprans/MeshSmoothing.pyx":1248
18439  * cdef double[3] eN_coords
18440  * eN_coords[0] = starting_coords[0]
18441  * eN_coords[1] = starting_coords[1] # <<<<<<<<<<<<<<
18442  * eN_coords[2] = starting_coords[2]
18443  * cdef double min_dist = sqrt((eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
18444  */
18445  __pyx_t_2 = 1;
18446  if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_starting_coords.shape[0];
18447  (__pyx_v_eN_coords[1]) = (*((double *) ( /* dim=0 */ (__pyx_v_starting_coords.data + __pyx_t_2 * __pyx_v_starting_coords.strides[0]) )));
18448 
18449  /* "mprans/MeshSmoothing.pyx":1249
18450  * eN_coords[0] = starting_coords[0]
18451  * eN_coords[1] = starting_coords[1]
18452  * eN_coords[2] = starting_coords[2] # <<<<<<<<<<<<<<
18453  * cdef double min_dist = sqrt((eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
18454  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\
18455  */
18456  __pyx_t_3 = 2;
18457  if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_starting_coords.shape[0];
18458  (__pyx_v_eN_coords[2]) = (*((double *) ( /* dim=0 */ (__pyx_v_starting_coords.data + __pyx_t_3 * __pyx_v_starting_coords.strides[0]) )));
18459 
18460  /* "mprans/MeshSmoothing.pyx":1250
18461  * eN_coords[1] = starting_coords[1]
18462  * eN_coords[2] = starting_coords[2]
18463  * cdef double min_dist = sqrt((eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\ # <<<<<<<<<<<<<<
18464  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\
18465  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2]))
18466  */
18467  __pyx_t_4 = 0;
18468  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coords.shape[0];
18469  __pyx_t_5 = 0;
18470  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_coords.shape[0];
18471 
18472  /* "mprans/MeshSmoothing.pyx":1251
18473  * eN_coords[2] = starting_coords[2]
18474  * cdef double min_dist = sqrt((eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
18475  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\ # <<<<<<<<<<<<<<
18476  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2]))
18477  * cdef double[3] direction
18478  */
18479  __pyx_t_6 = 1;
18480  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coords.shape[0];
18481  __pyx_t_7 = 1;
18482  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coords.shape[0];
18483 
18484  /* "mprans/MeshSmoothing.pyx":1252
18485  * cdef double min_dist = sqrt((eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
18486  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\
18487  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])) # <<<<<<<<<<<<<<
18488  * cdef double[3] direction
18489  * direction[0] = (coords[0]-eN_coords[0])/min_dist
18490  */
18491  __pyx_t_8 = 2;
18492  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coords.shape[0];
18493  __pyx_t_9 = 2;
18494  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coords.shape[0];
18495 
18496  /* "mprans/MeshSmoothing.pyx":1250
18497  * eN_coords[1] = starting_coords[1]
18498  * eN_coords[2] = starting_coords[2]
18499  * cdef double min_dist = sqrt((eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\ # <<<<<<<<<<<<<<
18500  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\
18501  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2]))
18502  */
18503  __pyx_v_min_dist = sqrt((((((__pyx_v_eN_coords[0]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_4 * __pyx_v_coords.strides[0]) )))) * ((__pyx_v_eN_coords[0]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_5 * __pyx_v_coords.strides[0]) ))))) + (((__pyx_v_eN_coords[1]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_6 * __pyx_v_coords.strides[0]) )))) * ((__pyx_v_eN_coords[1]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_7 * __pyx_v_coords.strides[0]) )))))) + (((__pyx_v_eN_coords[2]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_8 * __pyx_v_coords.strides[0]) )))) * ((__pyx_v_eN_coords[2]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_9 * __pyx_v_coords.strides[0]) )))))));
18504 
18505  /* "mprans/MeshSmoothing.pyx":1254
18506  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2]))
18507  * cdef double[3] direction
18508  * direction[0] = (coords[0]-eN_coords[0])/min_dist # <<<<<<<<<<<<<<
18509  * direction[1] = (coords[1]-eN_coords[1])/min_dist
18510  * direction[2] = (coords[2]-eN_coords[2])/min_dist
18511  */
18512  __pyx_t_10 = 0;
18513  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coords.shape[0];
18514  (__pyx_v_direction[0]) = (((*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_10 * __pyx_v_coords.strides[0]) ))) - (__pyx_v_eN_coords[0])) / __pyx_v_min_dist);
18515 
18516  /* "mprans/MeshSmoothing.pyx":1255
18517  * cdef double[3] direction
18518  * direction[0] = (coords[0]-eN_coords[0])/min_dist
18519  * direction[1] = (coords[1]-eN_coords[1])/min_dist # <<<<<<<<<<<<<<
18520  * direction[2] = (coords[2]-eN_coords[2])/min_dist
18521  * cdef int maxit = 5*elementBoundariesArray.shape[0]
18522  */
18523  __pyx_t_11 = 1;
18524  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coords.shape[0];
18525  (__pyx_v_direction[1]) = (((*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_11 * __pyx_v_coords.strides[0]) ))) - (__pyx_v_eN_coords[1])) / __pyx_v_min_dist);
18526 
18527  /* "mprans/MeshSmoothing.pyx":1256
18528  * direction[0] = (coords[0]-eN_coords[0])/min_dist
18529  * direction[1] = (coords[1]-eN_coords[1])/min_dist
18530  * direction[2] = (coords[2]-eN_coords[2])/min_dist # <<<<<<<<<<<<<<
18531  * cdef int maxit = 5*elementBoundariesArray.shape[0]
18532  * cdef int nEbn = elementBoundariesArray.shape[1] # nb boundaries per element
18533  */
18534  __pyx_t_12 = 2;
18535  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coords.shape[0];
18536  (__pyx_v_direction[2]) = (((*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_12 * __pyx_v_coords.strides[0]) ))) - (__pyx_v_eN_coords[2])) / __pyx_v_min_dist);
18537 
18538  /* "mprans/MeshSmoothing.pyx":1257
18539  * direction[1] = (coords[1]-eN_coords[1])/min_dist
18540  * direction[2] = (coords[2]-eN_coords[2])/min_dist
18541  * cdef int maxit = 5*elementBoundariesArray.shape[0] # <<<<<<<<<<<<<<
18542  * cdef int nEbn = elementBoundariesArray.shape[1] # nb boundaries per element
18543  * cdef int nearest_eN = eN
18544  */
18545  __pyx_v_maxit = (5 * (__pyx_v_elementBoundariesArray.shape[0]));
18546 
18547  /* "mprans/MeshSmoothing.pyx":1258
18548  * direction[2] = (coords[2]-eN_coords[2])/min_dist
18549  * cdef int maxit = 5*elementBoundariesArray.shape[0]
18550  * cdef int nEbn = elementBoundariesArray.shape[1] # nb boundaries per element # <<<<<<<<<<<<<<
18551  * cdef int nearest_eN = eN
18552  * cdef int nearest_eN0 = eN
18553  */
18554  __pyx_v_nEbn = (__pyx_v_elementBoundariesArray.shape[1]);
18555 
18556  /* "mprans/MeshSmoothing.pyx":1259
18557  * cdef int maxit = 5*elementBoundariesArray.shape[0]
18558  * cdef int nEbn = elementBoundariesArray.shape[1] # nb boundaries per element
18559  * cdef int nearest_eN = eN # <<<<<<<<<<<<<<
18560  * cdef int nearest_eN0 = eN
18561  * cdef int nOffsets
18562  */
18563  __pyx_v_nearest_eN = __pyx_v_eN;
18564 
18565  /* "mprans/MeshSmoothing.pyx":1260
18566  * cdef int nEbn = elementBoundariesArray.shape[1] # nb boundaries per element
18567  * cdef int nearest_eN = eN
18568  * cdef int nearest_eN0 = eN # <<<<<<<<<<<<<<
18569  * cdef int nOffsets
18570  * cdef double dist
18571  */
18572  __pyx_v_nearest_eN0 = __pyx_v_eN;
18573 
18574  /* "mprans/MeshSmoothing.pyx":1263
18575  * cdef int nOffsets
18576  * cdef double dist
18577  * cdef bool found_eN = False # <<<<<<<<<<<<<<
18578  * cdef int i = 0
18579  * cdef double[:] bound_bar # barycenter of boundary
18580  */
18581  __pyx_v_found_eN = 0;
18582 
18583  /* "mprans/MeshSmoothing.pyx":1264
18584  * cdef double dist
18585  * cdef bool found_eN = False
18586  * cdef int i = 0 # <<<<<<<<<<<<<<
18587  * cdef double[:] bound_bar # barycenter of boundary
18588  * cdef double alpha # distance
18589  */
18590  __pyx_v_i = 0;
18591 
18592  /* "mprans/MeshSmoothing.pyx":1268
18593  * cdef double alpha # distance
18594  * cdef int b_i # boundary index element
18595  * cdef int b_i_last = -1 # <<<<<<<<<<<<<<
18596  * cdef double[:] normal # element boundary normal
18597  * cdef double dot # dot product result
18598  */
18599  __pyx_v_b_i_last = -1;
18600 
18601  /* "mprans/MeshSmoothing.pyx":1272
18602  * cdef double dot # dot product result
18603  * cdef double dot2 # dot product 2 result
18604  * cdef int it = 0 # <<<<<<<<<<<<<<
18605  * cdef int eN_
18606  * cdef int j
18607  */
18608  __pyx_v_it = 0;
18609 
18610  /* "mprans/MeshSmoothing.pyx":1276
18611  * cdef int j
18612  * cdef int k
18613  * while found_eN is False and it < maxit: # <<<<<<<<<<<<<<
18614  * nearest_eN0 = nearest_eN
18615  * alpha_min = 1e12
18616  */
18617  while (1) {
18618  __pyx_t_14 = ((__pyx_v_found_eN == 0) != 0);
18619  if (__pyx_t_14) {
18620  } else {
18621  __pyx_t_13 = __pyx_t_14;
18622  goto __pyx_L5_bool_binop_done;
18623  }
18624  __pyx_t_14 = ((__pyx_v_it < __pyx_v_maxit) != 0);
18625  __pyx_t_13 = __pyx_t_14;
18626  __pyx_L5_bool_binop_done:;
18627  if (!__pyx_t_13) break;
18628 
18629  /* "mprans/MeshSmoothing.pyx":1277
18630  * cdef int k
18631  * while found_eN is False and it < maxit:
18632  * nearest_eN0 = nearest_eN # <<<<<<<<<<<<<<
18633  * alpha_min = 1e12
18634  * for j in range(nEbn):
18635  */
18636  __pyx_v_nearest_eN0 = __pyx_v_nearest_eN;
18637 
18638  /* "mprans/MeshSmoothing.pyx":1278
18639  * while found_eN is False and it < maxit:
18640  * nearest_eN0 = nearest_eN
18641  * alpha_min = 1e12 # <<<<<<<<<<<<<<
18642  * for j in range(nEbn):
18643  * b_i = elementBoundariesArray[nearest_eN0, j]
18644  */
18645  __pyx_v_alpha_min = 1e12;
18646 
18647  /* "mprans/MeshSmoothing.pyx":1279
18648  * nearest_eN0 = nearest_eN
18649  * alpha_min = 1e12
18650  * for j in range(nEbn): # <<<<<<<<<<<<<<
18651  * b_i = elementBoundariesArray[nearest_eN0, j]
18652  * # if b_i != b_i_last:
18653  */
18654  __pyx_t_15 = __pyx_v_nEbn;
18655  __pyx_t_16 = __pyx_t_15;
18656  for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
18657  __pyx_v_j = __pyx_t_17;
18658 
18659  /* "mprans/MeshSmoothing.pyx":1280
18660  * alpha_min = 1e12
18661  * for j in range(nEbn):
18662  * b_i = elementBoundariesArray[nearest_eN0, j] # <<<<<<<<<<<<<<
18663  * # if b_i != b_i_last:
18664  * normal = elementBoundaryNormalsArray[nearest_eN0, j]
18665  */
18666  __pyx_t_18 = __pyx_v_nearest_eN0;
18667  __pyx_t_19 = __pyx_v_j;
18668  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_elementBoundariesArray.shape[0];
18669  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_elementBoundariesArray.shape[1];
18670  __pyx_v_b_i = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundariesArray.data + __pyx_t_18 * __pyx_v_elementBoundariesArray.strides[0]) ) + __pyx_t_19 * __pyx_v_elementBoundariesArray.strides[1]) )));
18671 
18672  /* "mprans/MeshSmoothing.pyx":1282
18673  * b_i = elementBoundariesArray[nearest_eN0, j]
18674  * # if b_i != b_i_last:
18675  * normal = elementBoundaryNormalsArray[nearest_eN0, j] # <<<<<<<<<<<<<<
18676  * bound_bar = elementBoundaryBarycentersArray[b_i]
18677  * dot = normal[0]*direction[0]+normal[1]*direction[1]+normal[2]*direction[2]
18678  */
18679  __pyx_t_20.data = __pyx_v_elementBoundaryNormalsArray.data;
18680  __pyx_t_20.memview = __pyx_v_elementBoundaryNormalsArray.memview;
18681  __PYX_INC_MEMVIEW(&__pyx_t_20, 0);
18682  {
18683  Py_ssize_t __pyx_tmp_idx = __pyx_v_nearest_eN0;
18684  Py_ssize_t __pyx_tmp_shape = __pyx_v_elementBoundaryNormalsArray.shape[0];
18685  Py_ssize_t __pyx_tmp_stride = __pyx_v_elementBoundaryNormalsArray.strides[0];
18686  if (__pyx_tmp_idx < 0)
18687  __pyx_tmp_idx += __pyx_tmp_shape;
18688  if ((0)) __PYX_ERR(0, 1282, __pyx_L1_error)
18689  __pyx_t_20.data += __pyx_tmp_idx * __pyx_tmp_stride;
18690 }
18691 
18692 {
18693  Py_ssize_t __pyx_tmp_idx = __pyx_v_j;
18694  Py_ssize_t __pyx_tmp_shape = __pyx_v_elementBoundaryNormalsArray.shape[1];
18695  Py_ssize_t __pyx_tmp_stride = __pyx_v_elementBoundaryNormalsArray.strides[1];
18696  if (__pyx_tmp_idx < 0)
18697  __pyx_tmp_idx += __pyx_tmp_shape;
18698  if ((0)) __PYX_ERR(0, 1282, __pyx_L1_error)
18699  __pyx_t_20.data += __pyx_tmp_idx * __pyx_tmp_stride;
18700 }
18701 
18702 __pyx_t_20.shape[0] = __pyx_v_elementBoundaryNormalsArray.shape[2];
18703 __pyx_t_20.strides[0] = __pyx_v_elementBoundaryNormalsArray.strides[2];
18704  __pyx_t_20.suboffsets[0] = -1;
18705 
18706 __PYX_XDEC_MEMVIEW(&__pyx_v_normal, 1);
18707  __pyx_v_normal = __pyx_t_20;
18708  __pyx_t_20.memview = NULL;
18709  __pyx_t_20.data = NULL;
18710 
18711  /* "mprans/MeshSmoothing.pyx":1283
18712  * # if b_i != b_i_last:
18713  * normal = elementBoundaryNormalsArray[nearest_eN0, j]
18714  * bound_bar = elementBoundaryBarycentersArray[b_i] # <<<<<<<<<<<<<<
18715  * dot = normal[0]*direction[0]+normal[1]*direction[1]+normal[2]*direction[2]
18716  * if dot > 0.:
18717  */
18718  __pyx_t_20.data = __pyx_v_elementBoundaryBarycentersArray.data;
18719  __pyx_t_20.memview = __pyx_v_elementBoundaryBarycentersArray.memview;
18720  __PYX_INC_MEMVIEW(&__pyx_t_20, 0);
18721  {
18722  Py_ssize_t __pyx_tmp_idx = __pyx_v_b_i;
18723  Py_ssize_t __pyx_tmp_shape = __pyx_v_elementBoundaryBarycentersArray.shape[0];
18724  Py_ssize_t __pyx_tmp_stride = __pyx_v_elementBoundaryBarycentersArray.strides[0];
18725  if (__pyx_tmp_idx < 0)
18726  __pyx_tmp_idx += __pyx_tmp_shape;
18727  if ((0)) __PYX_ERR(0, 1283, __pyx_L1_error)
18728  __pyx_t_20.data += __pyx_tmp_idx * __pyx_tmp_stride;
18729 }
18730 
18731 __pyx_t_20.shape[0] = __pyx_v_elementBoundaryBarycentersArray.shape[1];
18732 __pyx_t_20.strides[0] = __pyx_v_elementBoundaryBarycentersArray.strides[1];
18733  __pyx_t_20.suboffsets[0] = -1;
18734 
18735 __PYX_XDEC_MEMVIEW(&__pyx_v_bound_bar, 1);
18736  __pyx_v_bound_bar = __pyx_t_20;
18737  __pyx_t_20.memview = NULL;
18738  __pyx_t_20.data = NULL;
18739 
18740  /* "mprans/MeshSmoothing.pyx":1284
18741  * normal = elementBoundaryNormalsArray[nearest_eN0, j]
18742  * bound_bar = elementBoundaryBarycentersArray[b_i]
18743  * dot = normal[0]*direction[0]+normal[1]*direction[1]+normal[2]*direction[2] # <<<<<<<<<<<<<<
18744  * if dot > 0.:
18745  * dot2 = (bound_bar[0]-eN_coords[0])*normal[0]+(bound_bar[1]-eN_coords[1])*normal[1]+(bound_bar[2]-eN_coords[2])*normal[2]
18746  */
18747  __pyx_t_21 = 0;
18748  if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_normal.shape[0];
18749  __pyx_t_22 = 1;
18750  if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_normal.shape[0];
18751  __pyx_t_23 = 2;
18752  if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_normal.shape[0];
18753  __pyx_v_dot = ((((*((double *) ( /* dim=0 */ (__pyx_v_normal.data + __pyx_t_21 * __pyx_v_normal.strides[0]) ))) * (__pyx_v_direction[0])) + ((*((double *) ( /* dim=0 */ (__pyx_v_normal.data + __pyx_t_22 * __pyx_v_normal.strides[0]) ))) * (__pyx_v_direction[1]))) + ((*((double *) ( /* dim=0 */ (__pyx_v_normal.data + __pyx_t_23 * __pyx_v_normal.strides[0]) ))) * (__pyx_v_direction[2])));
18754 
18755  /* "mprans/MeshSmoothing.pyx":1285
18756  * bound_bar = elementBoundaryBarycentersArray[b_i]
18757  * dot = normal[0]*direction[0]+normal[1]*direction[1]+normal[2]*direction[2]
18758  * if dot > 0.: # <<<<<<<<<<<<<<
18759  * dot2 = (bound_bar[0]-eN_coords[0])*normal[0]+(bound_bar[1]-eN_coords[1])*normal[1]+(bound_bar[2]-eN_coords[2])*normal[2]
18760  * if dot2 >= 0.:
18761  */
18762  __pyx_t_13 = ((__pyx_v_dot > 0.) != 0);
18763  if (__pyx_t_13) {
18764 
18765  /* "mprans/MeshSmoothing.pyx":1286
18766  * dot = normal[0]*direction[0]+normal[1]*direction[1]+normal[2]*direction[2]
18767  * if dot > 0.:
18768  * dot2 = (bound_bar[0]-eN_coords[0])*normal[0]+(bound_bar[1]-eN_coords[1])*normal[1]+(bound_bar[2]-eN_coords[2])*normal[2] # <<<<<<<<<<<<<<
18769  * if dot2 >= 0.:
18770  * alpha = dot2/dot
18771  */
18772  __pyx_t_24 = 0;
18773  if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_bound_bar.shape[0];
18774  __pyx_t_25 = 0;
18775  if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_normal.shape[0];
18776  __pyx_t_26 = 1;
18777  if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_bound_bar.shape[0];
18778  __pyx_t_27 = 1;
18779  if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_normal.shape[0];
18780  __pyx_t_28 = 2;
18781  if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_bound_bar.shape[0];
18782  __pyx_t_29 = 2;
18783  if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_normal.shape[0];
18784  __pyx_v_dot2 = (((((*((double *) ( /* dim=0 */ (__pyx_v_bound_bar.data + __pyx_t_24 * __pyx_v_bound_bar.strides[0]) ))) - (__pyx_v_eN_coords[0])) * (*((double *) ( /* dim=0 */ (__pyx_v_normal.data + __pyx_t_25 * __pyx_v_normal.strides[0]) )))) + (((*((double *) ( /* dim=0 */ (__pyx_v_bound_bar.data + __pyx_t_26 * __pyx_v_bound_bar.strides[0]) ))) - (__pyx_v_eN_coords[1])) * (*((double *) ( /* dim=0 */ (__pyx_v_normal.data + __pyx_t_27 * __pyx_v_normal.strides[0]) ))))) + (((*((double *) ( /* dim=0 */ (__pyx_v_bound_bar.data + __pyx_t_28 * __pyx_v_bound_bar.strides[0]) ))) - (__pyx_v_eN_coords[2])) * (*((double *) ( /* dim=0 */ (__pyx_v_normal.data + __pyx_t_29 * __pyx_v_normal.strides[0]) )))));
18785 
18786  /* "mprans/MeshSmoothing.pyx":1287
18787  * if dot > 0.:
18788  * dot2 = (bound_bar[0]-eN_coords[0])*normal[0]+(bound_bar[1]-eN_coords[1])*normal[1]+(bound_bar[2]-eN_coords[2])*normal[2]
18789  * if dot2 >= 0.: # <<<<<<<<<<<<<<
18790  * alpha = dot2/dot
18791  * if 0. <= alpha < alpha_min:
18792  */
18793  __pyx_t_13 = ((__pyx_v_dot2 >= 0.) != 0);
18794  if (__pyx_t_13) {
18795 
18796  /* "mprans/MeshSmoothing.pyx":1288
18797  * dot2 = (bound_bar[0]-eN_coords[0])*normal[0]+(bound_bar[1]-eN_coords[1])*normal[1]+(bound_bar[2]-eN_coords[2])*normal[2]
18798  * if dot2 >= 0.:
18799  * alpha = dot2/dot # <<<<<<<<<<<<<<
18800  * if 0. <= alpha < alpha_min:
18801  * alpha_min = alpha
18802  */
18803  __pyx_v_alpha = (__pyx_v_dot2 / __pyx_v_dot);
18804 
18805  /* "mprans/MeshSmoothing.pyx":1289
18806  * if dot2 >= 0.:
18807  * alpha = dot2/dot
18808  * if 0. <= alpha < alpha_min: # <<<<<<<<<<<<<<
18809  * alpha_min = alpha
18810  * for k in range(2):
18811  */
18812  __pyx_t_13 = (0. <= __pyx_v_alpha);
18813  if (__pyx_t_13) {
18814  __pyx_t_13 = (__pyx_v_alpha < __pyx_v_alpha_min);
18815  }
18816  __pyx_t_14 = (__pyx_t_13 != 0);
18817  if (__pyx_t_14) {
18818 
18819  /* "mprans/MeshSmoothing.pyx":1290
18820  * alpha = dot2/dot
18821  * if 0. <= alpha < alpha_min:
18822  * alpha_min = alpha # <<<<<<<<<<<<<<
18823  * for k in range(2):
18824  * eN_ = elementBoundaryElementsArray[b_i, k]
18825  */
18826  __pyx_v_alpha_min = __pyx_v_alpha;
18827 
18828  /* "mprans/MeshSmoothing.pyx":1291
18829  * if 0. <= alpha < alpha_min:
18830  * alpha_min = alpha
18831  * for k in range(2): # <<<<<<<<<<<<<<
18832  * eN_ = elementBoundaryElementsArray[b_i, k]
18833  * if eN_ != nearest_eN0:
18834  */
18835  for (__pyx_t_30 = 0; __pyx_t_30 < 2; __pyx_t_30+=1) {
18836  __pyx_v_k = __pyx_t_30;
18837 
18838  /* "mprans/MeshSmoothing.pyx":1292
18839  * alpha_min = alpha
18840  * for k in range(2):
18841  * eN_ = elementBoundaryElementsArray[b_i, k] # <<<<<<<<<<<<<<
18842  * if eN_ != nearest_eN0:
18843  * nearest_eN = eN_
18844  */
18845  __pyx_t_31 = __pyx_v_b_i;
18846  __pyx_t_32 = __pyx_v_k;
18847  if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_elementBoundaryElementsArray.shape[0];
18848  if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_elementBoundaryElementsArray.shape[1];
18849  __pyx_v_eN_ = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryElementsArray.data + __pyx_t_31 * __pyx_v_elementBoundaryElementsArray.strides[0]) ) + __pyx_t_32 * __pyx_v_elementBoundaryElementsArray.strides[1]) )));
18850 
18851  /* "mprans/MeshSmoothing.pyx":1293
18852  * for k in range(2):
18853  * eN_ = elementBoundaryElementsArray[b_i, k]
18854  * if eN_ != nearest_eN0: # <<<<<<<<<<<<<<
18855  * nearest_eN = eN_
18856  * # nearest_eN = elementBoundaryElementsArray[nearest_eN0]
18857  */
18858  __pyx_t_14 = ((__pyx_v_eN_ != __pyx_v_nearest_eN0) != 0);
18859  if (__pyx_t_14) {
18860 
18861  /* "mprans/MeshSmoothing.pyx":1294
18862  * eN_ = elementBoundaryElementsArray[b_i, k]
18863  * if eN_ != nearest_eN0:
18864  * nearest_eN = eN_ # <<<<<<<<<<<<<<
18865  * # nearest_eN = elementBoundaryElementsArray[nearest_eN0]
18866  * b_i_last = b_i
18867  */
18868  __pyx_v_nearest_eN = __pyx_v_eN_;
18869 
18870  /* "mprans/MeshSmoothing.pyx":1293
18871  * for k in range(2):
18872  * eN_ = elementBoundaryElementsArray[b_i, k]
18873  * if eN_ != nearest_eN0: # <<<<<<<<<<<<<<
18874  * nearest_eN = eN_
18875  * # nearest_eN = elementBoundaryElementsArray[nearest_eN0]
18876  */
18877  }
18878  }
18879 
18880  /* "mprans/MeshSmoothing.pyx":1296
18881  * nearest_eN = eN_
18882  * # nearest_eN = elementBoundaryElementsArray[nearest_eN0]
18883  * b_i_last = b_i # <<<<<<<<<<<<<<
18884  * if nearest_eN != nearest_eN0:
18885  * if min_dist-alpha_min >=0:
18886  */
18887  __pyx_v_b_i_last = __pyx_v_b_i;
18888 
18889  /* "mprans/MeshSmoothing.pyx":1289
18890  * if dot2 >= 0.:
18891  * alpha = dot2/dot
18892  * if 0. <= alpha < alpha_min: # <<<<<<<<<<<<<<
18893  * alpha_min = alpha
18894  * for k in range(2):
18895  */
18896  }
18897 
18898  /* "mprans/MeshSmoothing.pyx":1287
18899  * if dot > 0.:
18900  * dot2 = (bound_bar[0]-eN_coords[0])*normal[0]+(bound_bar[1]-eN_coords[1])*normal[1]+(bound_bar[2]-eN_coords[2])*normal[2]
18901  * if dot2 >= 0.: # <<<<<<<<<<<<<<
18902  * alpha = dot2/dot
18903  * if 0. <= alpha < alpha_min:
18904  */
18905  }
18906 
18907  /* "mprans/MeshSmoothing.pyx":1285
18908  * bound_bar = elementBoundaryBarycentersArray[b_i]
18909  * dot = normal[0]*direction[0]+normal[1]*direction[1]+normal[2]*direction[2]
18910  * if dot > 0.: # <<<<<<<<<<<<<<
18911  * dot2 = (bound_bar[0]-eN_coords[0])*normal[0]+(bound_bar[1]-eN_coords[1])*normal[1]+(bound_bar[2]-eN_coords[2])*normal[2]
18912  * if dot2 >= 0.:
18913  */
18914  }
18915  }
18916 
18917  /* "mprans/MeshSmoothing.pyx":1297
18918  * # nearest_eN = elementBoundaryElementsArray[nearest_eN0]
18919  * b_i_last = b_i
18920  * if nearest_eN != nearest_eN0: # <<<<<<<<<<<<<<
18921  * if min_dist-alpha_min >=0:
18922  * eN_coords[0] += alpha_min*direction[0]
18923  */
18924  __pyx_t_14 = ((__pyx_v_nearest_eN != __pyx_v_nearest_eN0) != 0);
18925  if (__pyx_t_14) {
18926 
18927  /* "mprans/MeshSmoothing.pyx":1298
18928  * b_i_last = b_i
18929  * if nearest_eN != nearest_eN0:
18930  * if min_dist-alpha_min >=0: # <<<<<<<<<<<<<<
18931  * eN_coords[0] += alpha_min*direction[0]
18932  * eN_coords[1] += alpha_min*direction[1]
18933  */
18934  __pyx_t_14 = (((__pyx_v_min_dist - __pyx_v_alpha_min) >= 0.0) != 0);
18935  if (__pyx_t_14) {
18936 
18937  /* "mprans/MeshSmoothing.pyx":1299
18938  * if nearest_eN != nearest_eN0:
18939  * if min_dist-alpha_min >=0:
18940  * eN_coords[0] += alpha_min*direction[0] # <<<<<<<<<<<<<<
18941  * eN_coords[1] += alpha_min*direction[1]
18942  * eN_coords[2] += alpha_min*direction[2]
18943  */
18944  __pyx_t_33 = 0;
18945  (__pyx_v_eN_coords[__pyx_t_33]) = ((__pyx_v_eN_coords[__pyx_t_33]) + (__pyx_v_alpha_min * (__pyx_v_direction[0])));
18946 
18947  /* "mprans/MeshSmoothing.pyx":1300
18948  * if min_dist-alpha_min >=0:
18949  * eN_coords[0] += alpha_min*direction[0]
18950  * eN_coords[1] += alpha_min*direction[1] # <<<<<<<<<<<<<<
18951  * eN_coords[2] += alpha_min*direction[2]
18952  * min_dist -= alpha_min
18953  */
18954  __pyx_t_33 = 1;
18955  (__pyx_v_eN_coords[__pyx_t_33]) = ((__pyx_v_eN_coords[__pyx_t_33]) + (__pyx_v_alpha_min * (__pyx_v_direction[1])));
18956 
18957  /* "mprans/MeshSmoothing.pyx":1301
18958  * eN_coords[0] += alpha_min*direction[0]
18959  * eN_coords[1] += alpha_min*direction[1]
18960  * eN_coords[2] += alpha_min*direction[2] # <<<<<<<<<<<<<<
18961  * min_dist -= alpha_min
18962  * else: # going too far
18963  */
18964  __pyx_t_33 = 2;
18965  (__pyx_v_eN_coords[__pyx_t_33]) = ((__pyx_v_eN_coords[__pyx_t_33]) + (__pyx_v_alpha_min * (__pyx_v_direction[2])));
18966 
18967  /* "mprans/MeshSmoothing.pyx":1302
18968  * eN_coords[1] += alpha_min*direction[1]
18969  * eN_coords[2] += alpha_min*direction[2]
18970  * min_dist -= alpha_min # <<<<<<<<<<<<<<
18971  * else: # going too far
18972  * nearest_eN = nearest_eN0
18973  */
18974  __pyx_v_min_dist = (__pyx_v_min_dist - __pyx_v_alpha_min);
18975 
18976  /* "mprans/MeshSmoothing.pyx":1298
18977  * b_i_last = b_i
18978  * if nearest_eN != nearest_eN0:
18979  * if min_dist-alpha_min >=0: # <<<<<<<<<<<<<<
18980  * eN_coords[0] += alpha_min*direction[0]
18981  * eN_coords[1] += alpha_min*direction[1]
18982  */
18983  goto __pyx_L16;
18984  }
18985 
18986  /* "mprans/MeshSmoothing.pyx":1304
18987  * min_dist -= alpha_min
18988  * else: # going too far
18989  * nearest_eN = nearest_eN0 # <<<<<<<<<<<<<<
18990  * if nearest_eN0 == nearest_eN or nearest_eN == -1:
18991  * found_eN = True
18992  */
18993  /*else*/ {
18994  __pyx_v_nearest_eN = __pyx_v_nearest_eN0;
18995  }
18996  __pyx_L16:;
18997 
18998  /* "mprans/MeshSmoothing.pyx":1297
18999  * # nearest_eN = elementBoundaryElementsArray[nearest_eN0]
19000  * b_i_last = b_i
19001  * if nearest_eN != nearest_eN0: # <<<<<<<<<<<<<<
19002  * if min_dist-alpha_min >=0:
19003  * eN_coords[0] += alpha_min*direction[0]
19004  */
19005  }
19006 
19007  /* "mprans/MeshSmoothing.pyx":1305
19008  * else: # going too far
19009  * nearest_eN = nearest_eN0
19010  * if nearest_eN0 == nearest_eN or nearest_eN == -1: # <<<<<<<<<<<<<<
19011  * found_eN = True
19012  * i += 1
19013  */
19014  __pyx_t_13 = ((__pyx_v_nearest_eN0 == __pyx_v_nearest_eN) != 0);
19015  if (!__pyx_t_13) {
19016  } else {
19017  __pyx_t_14 = __pyx_t_13;
19018  goto __pyx_L18_bool_binop_done;
19019  }
19020  __pyx_t_13 = ((__pyx_v_nearest_eN == -1L) != 0);
19021  __pyx_t_14 = __pyx_t_13;
19022  __pyx_L18_bool_binop_done:;
19023  if (__pyx_t_14) {
19024 
19025  /* "mprans/MeshSmoothing.pyx":1306
19026  * nearest_eN = nearest_eN0
19027  * if nearest_eN0 == nearest_eN or nearest_eN == -1:
19028  * found_eN = True # <<<<<<<<<<<<<<
19029  * i += 1
19030  * it += 1
19031  */
19032  __pyx_v_found_eN = 1;
19033 
19034  /* "mprans/MeshSmoothing.pyx":1305
19035  * else: # going too far
19036  * nearest_eN = nearest_eN0
19037  * if nearest_eN0 == nearest_eN or nearest_eN == -1: # <<<<<<<<<<<<<<
19038  * found_eN = True
19039  * i += 1
19040  */
19041  }
19042 
19043  /* "mprans/MeshSmoothing.pyx":1307
19044  * if nearest_eN0 == nearest_eN or nearest_eN == -1:
19045  * found_eN = True
19046  * i += 1 # <<<<<<<<<<<<<<
19047  * it += 1
19048  * if it >= maxit:
19049  */
19050  __pyx_v_i = (__pyx_v_i + 1);
19051 
19052  /* "mprans/MeshSmoothing.pyx":1308
19053  * found_eN = True
19054  * i += 1
19055  * it += 1 # <<<<<<<<<<<<<<
19056  * if it >= maxit:
19057  * assert 1>2, 'could not find element! (element {eN}: {x}, {y}, {z}), nearest_eN {nearest_eN}: closest coords: {x2}, {y2}, {z2}, after {maxit} iterations'.format(eN=eN,
19058  */
19059  __pyx_v_it = (__pyx_v_it + 1);
19060  }
19061 
19062  /* "mprans/MeshSmoothing.pyx":1309
19063  * i += 1
19064  * it += 1
19065  * if it >= maxit: # <<<<<<<<<<<<<<
19066  * assert 1>2, 'could not find element! (element {eN}: {x}, {y}, {z}), nearest_eN {nearest_eN}: closest coords: {x2}, {y2}, {z2}, after {maxit} iterations'.format(eN=eN,
19067  * x=coords[0],
19068  */
19069  __pyx_t_14 = ((__pyx_v_it >= __pyx_v_maxit) != 0);
19070  if (__pyx_t_14) {
19071 
19072  /* "mprans/MeshSmoothing.pyx":1310
19073  * it += 1
19074  * if it >= maxit:
19075  * assert 1>2, 'could not find element! (element {eN}: {x}, {y}, {z}), nearest_eN {nearest_eN}: closest coords: {x2}, {y2}, {z2}, after {maxit} iterations'.format(eN=eN, # <<<<<<<<<<<<<<
19076  * x=coords[0],
19077  * y=coords[1],
19078  */
19079  #ifndef CYTHON_WITHOUT_ASSERTIONS
19080  if (unlikely(!Py_OptimizeFlag)) {
19081  if (unlikely(!0)) {
19082  __pyx_t_34 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_could_not_find_element_element_e, __pyx_n_s_format); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 1310, __pyx_L1_error)
19083  __Pyx_GOTREF(__pyx_t_34);
19084  __pyx_t_35 = __Pyx_PyDict_NewPresized(9); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 1310, __pyx_L1_error)
19085  __Pyx_GOTREF(__pyx_t_35);
19086  __pyx_t_36 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 1310, __pyx_L1_error)
19087  __Pyx_GOTREF(__pyx_t_36);
19088  if (PyDict_SetItem(__pyx_t_35, __pyx_n_s_eN, __pyx_t_36) < 0) __PYX_ERR(0, 1310, __pyx_L1_error)
19089  __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
19090 
19091  /* "mprans/MeshSmoothing.pyx":1311
19092  * if it >= maxit:
19093  * assert 1>2, 'could not find element! (element {eN}: {x}, {y}, {z}), nearest_eN {nearest_eN}: closest coords: {x2}, {y2}, {z2}, after {maxit} iterations'.format(eN=eN,
19094  * x=coords[0], # <<<<<<<<<<<<<<
19095  * y=coords[1],
19096  * z=coords[2],
19097  */
19098  __pyx_t_37 = 0;
19099  if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_coords.shape[0];
19100  __pyx_t_36 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_37 * __pyx_v_coords.strides[0]) )))); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 1311, __pyx_L1_error)
19101  __Pyx_GOTREF(__pyx_t_36);
19102  if (PyDict_SetItem(__pyx_t_35, __pyx_n_s_x, __pyx_t_36) < 0) __PYX_ERR(0, 1310, __pyx_L1_error)
19103  __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
19104 
19105  /* "mprans/MeshSmoothing.pyx":1312
19106  * assert 1>2, 'could not find element! (element {eN}: {x}, {y}, {z}), nearest_eN {nearest_eN}: closest coords: {x2}, {y2}, {z2}, after {maxit} iterations'.format(eN=eN,
19107  * x=coords[0],
19108  * y=coords[1], # <<<<<<<<<<<<<<
19109  * z=coords[2],
19110  * nearest_eN=nearest_eN,
19111  */
19112  __pyx_t_38 = 1;
19113  if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_coords.shape[0];
19114  __pyx_t_36 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_38 * __pyx_v_coords.strides[0]) )))); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 1312, __pyx_L1_error)
19115  __Pyx_GOTREF(__pyx_t_36);
19116  if (PyDict_SetItem(__pyx_t_35, __pyx_n_s_y, __pyx_t_36) < 0) __PYX_ERR(0, 1310, __pyx_L1_error)
19117  __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
19118 
19119  /* "mprans/MeshSmoothing.pyx":1313
19120  * x=coords[0],
19121  * y=coords[1],
19122  * z=coords[2], # <<<<<<<<<<<<<<
19123  * nearest_eN=nearest_eN,
19124  * x2=eN_coords[0],
19125  */
19126  __pyx_t_39 = 2;
19127  if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_v_coords.shape[0];
19128  __pyx_t_36 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_39 * __pyx_v_coords.strides[0]) )))); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 1313, __pyx_L1_error)
19129  __Pyx_GOTREF(__pyx_t_36);
19130  if (PyDict_SetItem(__pyx_t_35, __pyx_n_s_z, __pyx_t_36) < 0) __PYX_ERR(0, 1310, __pyx_L1_error)
19131  __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
19132 
19133  /* "mprans/MeshSmoothing.pyx":1314
19134  * y=coords[1],
19135  * z=coords[2],
19136  * nearest_eN=nearest_eN, # <<<<<<<<<<<<<<
19137  * x2=eN_coords[0],
19138  * y2=eN_coords[1],
19139  */
19140  __pyx_t_36 = __Pyx_PyInt_From_int(__pyx_v_nearest_eN); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 1314, __pyx_L1_error)
19141  __Pyx_GOTREF(__pyx_t_36);
19142  if (PyDict_SetItem(__pyx_t_35, __pyx_n_s_nearest_eN, __pyx_t_36) < 0) __PYX_ERR(0, 1310, __pyx_L1_error)
19143  __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
19144 
19145  /* "mprans/MeshSmoothing.pyx":1315
19146  * z=coords[2],
19147  * nearest_eN=nearest_eN,
19148  * x2=eN_coords[0], # <<<<<<<<<<<<<<
19149  * y2=eN_coords[1],
19150  * z2=eN_coords[2],
19151  */
19152  __pyx_t_36 = PyFloat_FromDouble((__pyx_v_eN_coords[0])); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 1315, __pyx_L1_error)
19153  __Pyx_GOTREF(__pyx_t_36);
19154  if (PyDict_SetItem(__pyx_t_35, __pyx_n_s_x2, __pyx_t_36) < 0) __PYX_ERR(0, 1310, __pyx_L1_error)
19155  __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
19156 
19157  /* "mprans/MeshSmoothing.pyx":1316
19158  * nearest_eN=nearest_eN,
19159  * x2=eN_coords[0],
19160  * y2=eN_coords[1], # <<<<<<<<<<<<<<
19161  * z2=eN_coords[2],
19162  * maxit=maxit)
19163  */
19164  __pyx_t_36 = PyFloat_FromDouble((__pyx_v_eN_coords[1])); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 1316, __pyx_L1_error)
19165  __Pyx_GOTREF(__pyx_t_36);
19166  if (PyDict_SetItem(__pyx_t_35, __pyx_n_s_y2, __pyx_t_36) < 0) __PYX_ERR(0, 1310, __pyx_L1_error)
19167  __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
19168 
19169  /* "mprans/MeshSmoothing.pyx":1317
19170  * x2=eN_coords[0],
19171  * y2=eN_coords[1],
19172  * z2=eN_coords[2], # <<<<<<<<<<<<<<
19173  * maxit=maxit)
19174  * result[0] = nearest_eN
19175  */
19176  __pyx_t_36 = PyFloat_FromDouble((__pyx_v_eN_coords[2])); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 1317, __pyx_L1_error)
19177  __Pyx_GOTREF(__pyx_t_36);
19178  if (PyDict_SetItem(__pyx_t_35, __pyx_n_s_z2, __pyx_t_36) < 0) __PYX_ERR(0, 1310, __pyx_L1_error)
19179  __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
19180 
19181  /* "mprans/MeshSmoothing.pyx":1318
19182  * y2=eN_coords[1],
19183  * z2=eN_coords[2],
19184  * maxit=maxit) # <<<<<<<<<<<<<<
19185  * result[0] = nearest_eN
19186  * result[1] = b_i_last
19187  */
19188  __pyx_t_36 = __Pyx_PyInt_From_int(__pyx_v_maxit); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 1318, __pyx_L1_error)
19189  __Pyx_GOTREF(__pyx_t_36);
19190  if (PyDict_SetItem(__pyx_t_35, __pyx_n_s_maxit, __pyx_t_36) < 0) __PYX_ERR(0, 1310, __pyx_L1_error)
19191  __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
19192 
19193  /* "mprans/MeshSmoothing.pyx":1310
19194  * it += 1
19195  * if it >= maxit:
19196  * assert 1>2, 'could not find element! (element {eN}: {x}, {y}, {z}), nearest_eN {nearest_eN}: closest coords: {x2}, {y2}, {z2}, after {maxit} iterations'.format(eN=eN, # <<<<<<<<<<<<<<
19197  * x=coords[0],
19198  * y=coords[1],
19199  */
19200  __pyx_t_36 = __Pyx_PyObject_Call(__pyx_t_34, __pyx_empty_tuple, __pyx_t_35); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 1310, __pyx_L1_error)
19201  __Pyx_GOTREF(__pyx_t_36);
19202  __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
19203  __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0;
19204  __pyx_t_35 = PyTuple_Pack(1, __pyx_t_36); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 1310, __pyx_L1_error)
19205  __Pyx_GOTREF(__pyx_t_35);
19206  __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
19207  PyErr_SetObject(PyExc_AssertionError, __pyx_t_35);
19208  __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0;
19209  __PYX_ERR(0, 1310, __pyx_L1_error)
19210  }
19211  }
19212  #endif
19213 
19214  /* "mprans/MeshSmoothing.pyx":1309
19215  * i += 1
19216  * it += 1
19217  * if it >= maxit: # <<<<<<<<<<<<<<
19218  * assert 1>2, 'could not find element! (element {eN}: {x}, {y}, {z}), nearest_eN {nearest_eN}: closest coords: {x2}, {y2}, {z2}, after {maxit} iterations'.format(eN=eN,
19219  * x=coords[0],
19220  */
19221  }
19222 
19223  /* "mprans/MeshSmoothing.pyx":1319
19224  * z2=eN_coords[2],
19225  * maxit=maxit)
19226  * result[0] = nearest_eN # <<<<<<<<<<<<<<
19227  * result[1] = b_i_last
19228  * return result
19229  */
19230  (__pyx_v_result[0]) = __pyx_v_nearest_eN;
19231 
19232  /* "mprans/MeshSmoothing.pyx":1320
19233  * maxit=maxit)
19234  * result[0] = nearest_eN
19235  * result[1] = b_i_last # <<<<<<<<<<<<<<
19236  * return result
19237  *
19238  */
19239  (__pyx_v_result[1]) = __pyx_v_b_i_last;
19240 
19241  /* "mprans/MeshSmoothing.pyx":1321
19242  * result[0] = nearest_eN
19243  * result[1] = b_i_last
19244  * return result # <<<<<<<<<<<<<<
19245  *
19246  * cdef int pyxGetLocalNearestElementAroundNode(double[:] coords,
19247  */
19248  __pyx_t_36 = __pyx_format_from_typeinfo(&__Pyx_TypeInfo_int);
19249  __pyx_t_35 = Py_BuildValue((char*) "(" __PYX_BUILD_PY_SSIZE_T ")", ((Py_ssize_t)2));
19250  if (unlikely(!__pyx_t_36 || !__pyx_t_35 || !PyBytes_AsString(__pyx_t_36))) __PYX_ERR(0, 1321, __pyx_L1_error)
19251  __Pyx_GOTREF(__pyx_t_36);
19252  __Pyx_GOTREF(__pyx_t_35);
19253  __pyx_t_40 = __pyx_array_new(__pyx_t_35, sizeof(int), PyBytes_AS_STRING(__pyx_t_36), (char *) "fortran", (char *) __pyx_v_result);
19254  if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1321, __pyx_L1_error)
19255  __Pyx_GOTREF(__pyx_t_40);
19256  __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0;
19257  __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
19258  __pyx_t_41 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(((PyObject *)__pyx_t_40), PyBUF_WRITABLE); if (unlikely(!__pyx_t_41.memview)) __PYX_ERR(0, 1321, __pyx_L1_error)
19259  __Pyx_DECREF(((PyObject *)__pyx_t_40)); __pyx_t_40 = 0;
19260  __pyx_r = __pyx_t_41;
19261  __pyx_t_41.memview = NULL;
19262  __pyx_t_41.data = NULL;
19263  goto __pyx_L0;
19264 
19265  /* "mprans/MeshSmoothing.pyx":1233
19266  * return nearest_eN
19267  *
19268  * cdef int[:] pyxGetLocalNearestElementIntersection(double[:] coords, # <<<<<<<<<<<<<<
19269  * double[:] starting_coords,
19270  * double[:,:,:] elementBoundaryNormalsArray,
19271  */
19272 
19273  /* function exit code */
19274  __pyx_L1_error:;
19275  __PYX_XDEC_MEMVIEW(&__pyx_t_20, 1);
19276  __Pyx_XDECREF(__pyx_t_34);
19277  __Pyx_XDECREF(__pyx_t_35);
19278  __Pyx_XDECREF(__pyx_t_36);
19279  __Pyx_XDECREF(((PyObject *)__pyx_t_40));
19280  __PYX_XDEC_MEMVIEW(&__pyx_t_41, 1);
19281  __pyx_r.data = NULL;
19282  __pyx_r.memview = NULL;
19283  __Pyx_AddTraceback("mprans.MeshSmoothing.pyxGetLocalNearestElementIntersection", __pyx_clineno, __pyx_lineno, __pyx_filename);
19284  goto __pyx_L2;
19285  __pyx_L0:;
19286  if (unlikely(!__pyx_r.memview)) {
19287  PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
19288  }
19289  __pyx_L2:;
19290  __PYX_XDEC_MEMVIEW(&__pyx_v_bound_bar, 1);
19291  __PYX_XDEC_MEMVIEW(&__pyx_v_normal, 1);
19292  __Pyx_RefNannyFinishContext();
19293  return __pyx_r;
19294 }
19295 
19296 /* "mprans/MeshSmoothing.pyx":1323
19297  * return result
19298  *
19299  * cdef int pyxGetLocalNearestElementAroundNode(double[:] coords, # <<<<<<<<<<<<<<
19300  * int[:] nodeElementOffsets,
19301  * int[:] nodeElementsArray,
19302  */
19303 
19304 static int __pyx_f_6mprans_13MeshSmoothing_pyxGetLocalNearestElementAroundNode(__Pyx_memviewslice __pyx_v_coords, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_elementBarycentersArray, int __pyx_v_node) {
19305  double __pyx_v_dist;
19306  double __pyx_v_min_dist;
19307  __Pyx_memviewslice __pyx_v_eN_coords = { 0, 0, { 0 }, { 0 }, { 0 } };
19308  int __pyx_v_i;
19309  int __pyx_v_eN;
19310  int __pyx_v_iEn;
19311  int __pyx_v_rmin;
19312  int __pyx_v_rmax;
19313  int __pyx_v_nearest_eN;
19314  int __pyx_r;
19315  __Pyx_RefNannyDeclarations
19316  Py_ssize_t __pyx_t_1;
19317  Py_ssize_t __pyx_t_2;
19318  int __pyx_t_3;
19319  int __pyx_t_4;
19320  int __pyx_t_5;
19321  Py_ssize_t __pyx_t_6;
19322  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
19323  Py_ssize_t __pyx_t_8;
19324  Py_ssize_t __pyx_t_9;
19325  Py_ssize_t __pyx_t_10;
19326  Py_ssize_t __pyx_t_11;
19327  Py_ssize_t __pyx_t_12;
19328  Py_ssize_t __pyx_t_13;
19329  Py_ssize_t __pyx_t_14;
19330  Py_ssize_t __pyx_t_15;
19331  Py_ssize_t __pyx_t_16;
19332  Py_ssize_t __pyx_t_17;
19333  Py_ssize_t __pyx_t_18;
19334  Py_ssize_t __pyx_t_19;
19335  int __pyx_t_20;
19336  int __pyx_t_21;
19337  __Pyx_RefNannySetupContext("pyxGetLocalNearestElementAroundNode", 0);
19338 
19339  /* "mprans/MeshSmoothing.pyx":1331
19340  * cdef double min_dist
19341  * cdef double[:] eN_coords
19342  * cdef int i = 0 # <<<<<<<<<<<<<<
19343  * cdef int eN
19344  * cdef int iEn
19345  */
19346  __pyx_v_i = 0;
19347 
19348  /* "mprans/MeshSmoothing.pyx":1334
19349  * cdef int eN
19350  * cdef int iEn
19351  * cdef int rmin = nodeElementOffsets[node] # <<<<<<<<<<<<<<
19352  * cdef int rmax = nodeElementOffsets[node+1]
19353  * for iEn in range(rmin, rmax):
19354  */
19355  __pyx_t_1 = __pyx_v_node;
19356  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_nodeElementOffsets.shape[0];
19357  __pyx_v_rmin = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_1 * __pyx_v_nodeElementOffsets.strides[0]) )));
19358 
19359  /* "mprans/MeshSmoothing.pyx":1335
19360  * cdef int iEn
19361  * cdef int rmin = nodeElementOffsets[node]
19362  * cdef int rmax = nodeElementOffsets[node+1] # <<<<<<<<<<<<<<
19363  * for iEn in range(rmin, rmax):
19364  * eN = nodeElementsArray[iEn]
19365  */
19366  __pyx_t_2 = (__pyx_v_node + 1);
19367  if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_nodeElementOffsets.shape[0];
19368  __pyx_v_rmax = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_2 * __pyx_v_nodeElementOffsets.strides[0]) )));
19369 
19370  /* "mprans/MeshSmoothing.pyx":1336
19371  * cdef int rmin = nodeElementOffsets[node]
19372  * cdef int rmax = nodeElementOffsets[node+1]
19373  * for iEn in range(rmin, rmax): # <<<<<<<<<<<<<<
19374  * eN = nodeElementsArray[iEn]
19375  * eN_coords = elementBarycentersArray[eN]
19376  */
19377  __pyx_t_3 = __pyx_v_rmax;
19378  __pyx_t_4 = __pyx_t_3;
19379  for (__pyx_t_5 = __pyx_v_rmin; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
19380  __pyx_v_iEn = __pyx_t_5;
19381 
19382  /* "mprans/MeshSmoothing.pyx":1337
19383  * cdef int rmax = nodeElementOffsets[node+1]
19384  * for iEn in range(rmin, rmax):
19385  * eN = nodeElementsArray[iEn] # <<<<<<<<<<<<<<
19386  * eN_coords = elementBarycentersArray[eN]
19387  * dist = (eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
19388  */
19389  __pyx_t_6 = __pyx_v_iEn;
19390  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_nodeElementsArray.shape[0];
19391  __pyx_v_eN = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementsArray.data + __pyx_t_6 * __pyx_v_nodeElementsArray.strides[0]) )));
19392 
19393  /* "mprans/MeshSmoothing.pyx":1338
19394  * for iEn in range(rmin, rmax):
19395  * eN = nodeElementsArray[iEn]
19396  * eN_coords = elementBarycentersArray[eN] # <<<<<<<<<<<<<<
19397  * dist = (eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
19398  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\
19399  */
19400  __pyx_t_7.data = __pyx_v_elementBarycentersArray.data;
19401  __pyx_t_7.memview = __pyx_v_elementBarycentersArray.memview;
19402  __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
19403  {
19404  Py_ssize_t __pyx_tmp_idx = __pyx_v_eN;
19405  Py_ssize_t __pyx_tmp_shape = __pyx_v_elementBarycentersArray.shape[0];
19406  Py_ssize_t __pyx_tmp_stride = __pyx_v_elementBarycentersArray.strides[0];
19407  if (__pyx_tmp_idx < 0)
19408  __pyx_tmp_idx += __pyx_tmp_shape;
19409  if ((0)) __PYX_ERR(0, 1338, __pyx_L1_error)
19410  __pyx_t_7.data += __pyx_tmp_idx * __pyx_tmp_stride;
19411 }
19412 
19413 __pyx_t_7.shape[0] = __pyx_v_elementBarycentersArray.shape[1];
19414 __pyx_t_7.strides[0] = __pyx_v_elementBarycentersArray.strides[1];
19415  __pyx_t_7.suboffsets[0] = -1;
19416 
19417 __PYX_XDEC_MEMVIEW(&__pyx_v_eN_coords, 1);
19418  __pyx_v_eN_coords = __pyx_t_7;
19419  __pyx_t_7.memview = NULL;
19420  __pyx_t_7.data = NULL;
19421 
19422  /* "mprans/MeshSmoothing.pyx":1339
19423  * eN = nodeElementsArray[iEn]
19424  * eN_coords = elementBarycentersArray[eN]
19425  * dist = (eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\ # <<<<<<<<<<<<<<
19426  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\
19427  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])
19428  */
19429  __pyx_t_8 = 0;
19430  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_eN_coords.shape[0];
19431  __pyx_t_9 = 0;
19432  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coords.shape[0];
19433  __pyx_t_10 = 0;
19434  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_eN_coords.shape[0];
19435  __pyx_t_11 = 0;
19436  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coords.shape[0];
19437 
19438  /* "mprans/MeshSmoothing.pyx":1340
19439  * eN_coords = elementBarycentersArray[eN]
19440  * dist = (eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
19441  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\ # <<<<<<<<<<<<<<
19442  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])
19443  * if i == 0 or dist < min_dist:
19444  */
19445  __pyx_t_12 = 1;
19446  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_eN_coords.shape[0];
19447  __pyx_t_13 = 1;
19448  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coords.shape[0];
19449  __pyx_t_14 = 1;
19450  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_eN_coords.shape[0];
19451  __pyx_t_15 = 1;
19452  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coords.shape[0];
19453 
19454  /* "mprans/MeshSmoothing.pyx":1341
19455  * dist = (eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
19456  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\
19457  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2]) # <<<<<<<<<<<<<<
19458  * if i == 0 or dist < min_dist:
19459  * min_dist = dist
19460  */
19461  __pyx_t_16 = 2;
19462  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_eN_coords.shape[0];
19463  __pyx_t_17 = 2;
19464  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coords.shape[0];
19465  __pyx_t_18 = 2;
19466  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_eN_coords.shape[0];
19467  __pyx_t_19 = 2;
19468  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coords.shape[0];
19469 
19470  /* "mprans/MeshSmoothing.pyx":1340
19471  * eN_coords = elementBarycentersArray[eN]
19472  * dist = (eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
19473  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\ # <<<<<<<<<<<<<<
19474  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])
19475  * if i == 0 or dist < min_dist:
19476  */
19477  __pyx_v_dist = (((((*((double *) ( /* dim=0 */ (__pyx_v_eN_coords.data + __pyx_t_8 * __pyx_v_eN_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_9 * __pyx_v_coords.strides[0]) )))) * ((*((double *) ( /* dim=0 */ (__pyx_v_eN_coords.data + __pyx_t_10 * __pyx_v_eN_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_11 * __pyx_v_coords.strides[0]) ))))) + (((*((double *) ( /* dim=0 */ (__pyx_v_eN_coords.data + __pyx_t_12 * __pyx_v_eN_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_13 * __pyx_v_coords.strides[0]) )))) * ((*((double *) ( /* dim=0 */ (__pyx_v_eN_coords.data + __pyx_t_14 * __pyx_v_eN_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_15 * __pyx_v_coords.strides[0]) )))))) + (((*((double *) ( /* dim=0 */ (__pyx_v_eN_coords.data + __pyx_t_16 * __pyx_v_eN_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_17 * __pyx_v_coords.strides[0]) )))) * ((*((double *) ( /* dim=0 */ (__pyx_v_eN_coords.data + __pyx_t_18 * __pyx_v_eN_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_19 * __pyx_v_coords.strides[0]) ))))));
19478 
19479  /* "mprans/MeshSmoothing.pyx":1342
19480  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\
19481  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])
19482  * if i == 0 or dist < min_dist: # <<<<<<<<<<<<<<
19483  * min_dist = dist
19484  * nearest_eN = eN
19485  */
19486  __pyx_t_21 = ((__pyx_v_i == 0) != 0);
19487  if (!__pyx_t_21) {
19488  } else {
19489  __pyx_t_20 = __pyx_t_21;
19490  goto __pyx_L6_bool_binop_done;
19491  }
19492  __pyx_t_21 = ((__pyx_v_dist < __pyx_v_min_dist) != 0);
19493  __pyx_t_20 = __pyx_t_21;
19494  __pyx_L6_bool_binop_done:;
19495  if (__pyx_t_20) {
19496 
19497  /* "mprans/MeshSmoothing.pyx":1343
19498  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])
19499  * if i == 0 or dist < min_dist:
19500  * min_dist = dist # <<<<<<<<<<<<<<
19501  * nearest_eN = eN
19502  * i += 1
19503  */
19504  __pyx_v_min_dist = __pyx_v_dist;
19505 
19506  /* "mprans/MeshSmoothing.pyx":1344
19507  * if i == 0 or dist < min_dist:
19508  * min_dist = dist
19509  * nearest_eN = eN # <<<<<<<<<<<<<<
19510  * i += 1
19511  * # determine local nearest node distance
19512  */
19513  __pyx_v_nearest_eN = __pyx_v_eN;
19514 
19515  /* "mprans/MeshSmoothing.pyx":1342
19516  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\
19517  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])
19518  * if i == 0 or dist < min_dist: # <<<<<<<<<<<<<<
19519  * min_dist = dist
19520  * nearest_eN = eN
19521  */
19522  }
19523 
19524  /* "mprans/MeshSmoothing.pyx":1345
19525  * min_dist = dist
19526  * nearest_eN = eN
19527  * i += 1 # <<<<<<<<<<<<<<
19528  * # determine local nearest node distance
19529  * return nearest_eN
19530  */
19531  __pyx_v_i = (__pyx_v_i + 1);
19532  }
19533 
19534  /* "mprans/MeshSmoothing.pyx":1347
19535  * i += 1
19536  * # determine local nearest node distance
19537  * return nearest_eN # <<<<<<<<<<<<<<
19538  *
19539  * cdef void pyxUpdateElementBoundaryNormalsTetra(double[:,:,:] elementBoundaryNormalsArray_,
19540  */
19541  __pyx_r = __pyx_v_nearest_eN;
19542  goto __pyx_L0;
19543 
19544  /* "mprans/MeshSmoothing.pyx":1323
19545  * return result
19546  *
19547  * cdef int pyxGetLocalNearestElementAroundNode(double[:] coords, # <<<<<<<<<<<<<<
19548  * int[:] nodeElementOffsets,
19549  * int[:] nodeElementsArray,
19550  */
19551 
19552  /* function exit code */
19553  __pyx_L1_error:;
19554  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
19555  __Pyx_WriteUnraisable("mprans.MeshSmoothing.pyxGetLocalNearestElementAroundNode", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
19556  __pyx_r = 0;
19557  __pyx_L0:;
19558  __PYX_XDEC_MEMVIEW(&__pyx_v_eN_coords, 1);
19559  __Pyx_RefNannyFinishContext();
19560  return __pyx_r;
19561 }
19562 
19563 /* "mprans/MeshSmoothing.pyx":1349
19564  * return nearest_eN
19565  *
19566  * cdef void pyxUpdateElementBoundaryNormalsTetra(double[:,:,:] elementBoundaryNormalsArray_, # <<<<<<<<<<<<<<
19567  * double[:,:] nodeArray,
19568  * int[:,:] elementBoundariesArray,
19569  */
19570 
19571 static void __pyx_f_6mprans_13MeshSmoothing_pyxUpdateElementBoundaryNormalsTetra(__Pyx_memviewslice __pyx_v_elementBoundaryNormalsArray_, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementBoundariesArray, __Pyx_memviewslice __pyx_v_elementBoundaryNodesArray, __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray, __Pyx_memviewslice __pyx_v_elementBarycentersArray, int __pyx_v_nElements) {
19572  double __pyx_v_normal_check[3];
19573  double __pyx_v_U[3];
19574  double __pyx_v_V[3];
19575  int __pyx_v_b_i;
19576  __Pyx_memviewslice __pyx_v_node0 = { 0, 0, { 0 }, { 0 }, { 0 } };
19577  __Pyx_memviewslice __pyx_v_node1 = { 0, 0, { 0 }, { 0 }, { 0 } };
19578  __Pyx_memviewslice __pyx_v_node2 = { 0, 0, { 0 }, { 0 }, { 0 } };
19579  int __pyx_v_i;
19580  int __pyx_v_j;
19581  double __pyx_v_dot;
19582  double __pyx_v_lenghtn;
19583  __Pyx_RefNannyDeclarations
19584  int __pyx_t_1;
19585  int __pyx_t_2;
19586  int __pyx_t_3;
19587  int __pyx_t_4;
19588  Py_ssize_t __pyx_t_5;
19589  Py_ssize_t __pyx_t_6;
19590  Py_ssize_t __pyx_t_7;
19591  Py_ssize_t __pyx_t_8;
19592  Py_ssize_t __pyx_t_9;
19593  Py_ssize_t __pyx_t_10;
19594  __Pyx_memviewslice __pyx_t_11 = { 0, 0, { 0 }, { 0 }, { 0 } };
19595  Py_ssize_t __pyx_t_12;
19596  Py_ssize_t __pyx_t_13;
19597  Py_ssize_t __pyx_t_14;
19598  Py_ssize_t __pyx_t_15;
19599  Py_ssize_t __pyx_t_16;
19600  Py_ssize_t __pyx_t_17;
19601  Py_ssize_t __pyx_t_18;
19602  Py_ssize_t __pyx_t_19;
19603  Py_ssize_t __pyx_t_20;
19604  Py_ssize_t __pyx_t_21;
19605  Py_ssize_t __pyx_t_22;
19606  Py_ssize_t __pyx_t_23;
19607  Py_ssize_t __pyx_t_24;
19608  Py_ssize_t __pyx_t_25;
19609  Py_ssize_t __pyx_t_26;
19610  Py_ssize_t __pyx_t_27;
19611  Py_ssize_t __pyx_t_28;
19612  Py_ssize_t __pyx_t_29;
19613  Py_ssize_t __pyx_t_30;
19614  Py_ssize_t __pyx_t_31;
19615  Py_ssize_t __pyx_t_32;
19616  Py_ssize_t __pyx_t_33;
19617  Py_ssize_t __pyx_t_34;
19618  Py_ssize_t __pyx_t_35;
19619  Py_ssize_t __pyx_t_36;
19620  Py_ssize_t __pyx_t_37;
19621  Py_ssize_t __pyx_t_38;
19622  Py_ssize_t __pyx_t_39;
19623  Py_ssize_t __pyx_t_40;
19624  Py_ssize_t __pyx_t_41;
19625  Py_ssize_t __pyx_t_42;
19626  Py_ssize_t __pyx_t_43;
19627  Py_ssize_t __pyx_t_44;
19628  Py_ssize_t __pyx_t_45;
19629  Py_ssize_t __pyx_t_46;
19630  Py_ssize_t __pyx_t_47;
19631  Py_ssize_t __pyx_t_48;
19632  Py_ssize_t __pyx_t_49;
19633  Py_ssize_t __pyx_t_50;
19634  Py_ssize_t __pyx_t_51;
19635  Py_ssize_t __pyx_t_52;
19636  Py_ssize_t __pyx_t_53;
19637  Py_ssize_t __pyx_t_54;
19638  Py_ssize_t __pyx_t_55;
19639  Py_ssize_t __pyx_t_56;
19640  Py_ssize_t __pyx_t_57;
19641  Py_ssize_t __pyx_t_58;
19642  Py_ssize_t __pyx_t_59;
19643  Py_ssize_t __pyx_t_60;
19644  Py_ssize_t __pyx_t_61;
19645  Py_ssize_t __pyx_t_62;
19646  Py_ssize_t __pyx_t_63;
19647  Py_ssize_t __pyx_t_64;
19648  Py_ssize_t __pyx_t_65;
19649  Py_ssize_t __pyx_t_66;
19650  Py_ssize_t __pyx_t_67;
19651  Py_ssize_t __pyx_t_68;
19652  Py_ssize_t __pyx_t_69;
19653  Py_ssize_t __pyx_t_70;
19654  Py_ssize_t __pyx_t_71;
19655  Py_ssize_t __pyx_t_72;
19656  Py_ssize_t __pyx_t_73;
19657  Py_ssize_t __pyx_t_74;
19658  Py_ssize_t __pyx_t_75;
19659  Py_ssize_t __pyx_t_76;
19660  Py_ssize_t __pyx_t_77;
19661  Py_ssize_t __pyx_t_78;
19662  Py_ssize_t __pyx_t_79;
19663  int __pyx_t_80;
19664  Py_ssize_t __pyx_t_81;
19665  Py_ssize_t __pyx_t_82;
19666  Py_ssize_t __pyx_t_83;
19667  Py_ssize_t __pyx_t_84;
19668  Py_ssize_t __pyx_t_85;
19669  Py_ssize_t __pyx_t_86;
19670  Py_ssize_t __pyx_t_87;
19671  Py_ssize_t __pyx_t_88;
19672  Py_ssize_t __pyx_t_89;
19673  Py_ssize_t __pyx_t_90;
19674  Py_ssize_t __pyx_t_91;
19675  Py_ssize_t __pyx_t_92;
19676  Py_ssize_t __pyx_t_93;
19677  Py_ssize_t __pyx_t_94;
19678  Py_ssize_t __pyx_t_95;
19679  Py_ssize_t __pyx_t_96;
19680  Py_ssize_t __pyx_t_97;
19681  Py_ssize_t __pyx_t_98;
19682  __Pyx_RefNannySetupContext("pyxUpdateElementBoundaryNormalsTetra", 0);
19683 
19684  /* "mprans/MeshSmoothing.pyx":1366
19685  * cdef int j
19686  * cdef double dot
19687  * for i in range(nElements): # <<<<<<<<<<<<<<
19688  * for j in range(4):
19689  * b_i = elementBoundariesArray[i, j]
19690  */
19691  __pyx_t_1 = __pyx_v_nElements;
19692  __pyx_t_2 = __pyx_t_1;
19693  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
19694  __pyx_v_i = __pyx_t_3;
19695 
19696  /* "mprans/MeshSmoothing.pyx":1367
19697  * cdef double dot
19698  * for i in range(nElements):
19699  * for j in range(4): # <<<<<<<<<<<<<<
19700  * b_i = elementBoundariesArray[i, j]
19701  * node0 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],0]]
19702  */
19703  for (__pyx_t_4 = 0; __pyx_t_4 < 4; __pyx_t_4+=1) {
19704  __pyx_v_j = __pyx_t_4;
19705 
19706  /* "mprans/MeshSmoothing.pyx":1368
19707  * for i in range(nElements):
19708  * for j in range(4):
19709  * b_i = elementBoundariesArray[i, j] # <<<<<<<<<<<<<<
19710  * node0 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],0]]
19711  * node1 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],1]]
19712  */
19713  __pyx_t_5 = __pyx_v_i;
19714  __pyx_t_6 = __pyx_v_j;
19715  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBoundariesArray.shape[0];
19716  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_elementBoundariesArray.shape[1];
19717  __pyx_v_b_i = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundariesArray.data + __pyx_t_5 * __pyx_v_elementBoundariesArray.strides[0]) ) + __pyx_t_6 * __pyx_v_elementBoundariesArray.strides[1]) )));
19718 
19719  /* "mprans/MeshSmoothing.pyx":1369
19720  * for j in range(4):
19721  * b_i = elementBoundariesArray[i, j]
19722  * node0 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],0]] # <<<<<<<<<<<<<<
19723  * node1 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],1]]
19724  * node2 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],2]]
19725  */
19726  __pyx_t_7 = __pyx_v_i;
19727  __pyx_t_8 = __pyx_v_j;
19728  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_elementBoundariesArray.shape[0];
19729  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_elementBoundariesArray.shape[1];
19730  __pyx_t_9 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundariesArray.data + __pyx_t_7 * __pyx_v_elementBoundariesArray.strides[0]) ) + __pyx_t_8 * __pyx_v_elementBoundariesArray.strides[1]) )));
19731  __pyx_t_10 = 0;
19732  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_elementBoundaryNodesArray.shape[0];
19733  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_elementBoundaryNodesArray.shape[1];
19734  __pyx_t_11.data = __pyx_v_nodeArray.data;
19735  __pyx_t_11.memview = __pyx_v_nodeArray.memview;
19736  __PYX_INC_MEMVIEW(&__pyx_t_11, 0);
19737  {
19738  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNodesArray.data + __pyx_t_9 * __pyx_v_elementBoundaryNodesArray.strides[0]) ) + __pyx_t_10 * __pyx_v_elementBoundaryNodesArray.strides[1]) )));
19739  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
19740  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
19741  if (__pyx_tmp_idx < 0)
19742  __pyx_tmp_idx += __pyx_tmp_shape;
19743  if ((0)) __PYX_ERR(0, 1369, __pyx_L1_error)
19744  __pyx_t_11.data += __pyx_tmp_idx * __pyx_tmp_stride;
19745 }
19746 
19747 __pyx_t_11.shape[0] = __pyx_v_nodeArray.shape[1];
19748 __pyx_t_11.strides[0] = __pyx_v_nodeArray.strides[1];
19749  __pyx_t_11.suboffsets[0] = -1;
19750 
19751 __PYX_XDEC_MEMVIEW(&__pyx_v_node0, 1);
19752  __pyx_v_node0 = __pyx_t_11;
19753  __pyx_t_11.memview = NULL;
19754  __pyx_t_11.data = NULL;
19755 
19756  /* "mprans/MeshSmoothing.pyx":1370
19757  * b_i = elementBoundariesArray[i, j]
19758  * node0 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],0]]
19759  * node1 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],1]] # <<<<<<<<<<<<<<
19760  * node2 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],2]]
19761  * U[0] = node1[0]-node0[0]
19762  */
19763  __pyx_t_12 = __pyx_v_i;
19764  __pyx_t_13 = __pyx_v_j;
19765  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_elementBoundariesArray.shape[0];
19766  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_elementBoundariesArray.shape[1];
19767  __pyx_t_14 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundariesArray.data + __pyx_t_12 * __pyx_v_elementBoundariesArray.strides[0]) ) + __pyx_t_13 * __pyx_v_elementBoundariesArray.strides[1]) )));
19768  __pyx_t_15 = 1;
19769  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_elementBoundaryNodesArray.shape[0];
19770  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_elementBoundaryNodesArray.shape[1];
19771  __pyx_t_11.data = __pyx_v_nodeArray.data;
19772  __pyx_t_11.memview = __pyx_v_nodeArray.memview;
19773  __PYX_INC_MEMVIEW(&__pyx_t_11, 0);
19774  {
19775  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNodesArray.data + __pyx_t_14 * __pyx_v_elementBoundaryNodesArray.strides[0]) ) + __pyx_t_15 * __pyx_v_elementBoundaryNodesArray.strides[1]) )));
19776  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
19777  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
19778  if (__pyx_tmp_idx < 0)
19779  __pyx_tmp_idx += __pyx_tmp_shape;
19780  if ((0)) __PYX_ERR(0, 1370, __pyx_L1_error)
19781  __pyx_t_11.data += __pyx_tmp_idx * __pyx_tmp_stride;
19782 }
19783 
19784 __pyx_t_11.shape[0] = __pyx_v_nodeArray.shape[1];
19785 __pyx_t_11.strides[0] = __pyx_v_nodeArray.strides[1];
19786  __pyx_t_11.suboffsets[0] = -1;
19787 
19788 __PYX_XDEC_MEMVIEW(&__pyx_v_node1, 1);
19789  __pyx_v_node1 = __pyx_t_11;
19790  __pyx_t_11.memview = NULL;
19791  __pyx_t_11.data = NULL;
19792 
19793  /* "mprans/MeshSmoothing.pyx":1371
19794  * node0 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],0]]
19795  * node1 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],1]]
19796  * node2 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],2]] # <<<<<<<<<<<<<<
19797  * U[0] = node1[0]-node0[0]
19798  * U[1] = node1[1]-node0[1]
19799  */
19800  __pyx_t_16 = __pyx_v_i;
19801  __pyx_t_17 = __pyx_v_j;
19802  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_elementBoundariesArray.shape[0];
19803  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_elementBoundariesArray.shape[1];
19804  __pyx_t_18 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundariesArray.data + __pyx_t_16 * __pyx_v_elementBoundariesArray.strides[0]) ) + __pyx_t_17 * __pyx_v_elementBoundariesArray.strides[1]) )));
19805  __pyx_t_19 = 2;
19806  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_elementBoundaryNodesArray.shape[0];
19807  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_elementBoundaryNodesArray.shape[1];
19808  __pyx_t_11.data = __pyx_v_nodeArray.data;
19809  __pyx_t_11.memview = __pyx_v_nodeArray.memview;
19810  __PYX_INC_MEMVIEW(&__pyx_t_11, 0);
19811  {
19812  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNodesArray.data + __pyx_t_18 * __pyx_v_elementBoundaryNodesArray.strides[0]) ) + __pyx_t_19 * __pyx_v_elementBoundaryNodesArray.strides[1]) )));
19813  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
19814  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
19815  if (__pyx_tmp_idx < 0)
19816  __pyx_tmp_idx += __pyx_tmp_shape;
19817  if ((0)) __PYX_ERR(0, 1371, __pyx_L1_error)
19818  __pyx_t_11.data += __pyx_tmp_idx * __pyx_tmp_stride;
19819 }
19820 
19821 __pyx_t_11.shape[0] = __pyx_v_nodeArray.shape[1];
19822 __pyx_t_11.strides[0] = __pyx_v_nodeArray.strides[1];
19823  __pyx_t_11.suboffsets[0] = -1;
19824 
19825 __PYX_XDEC_MEMVIEW(&__pyx_v_node2, 1);
19826  __pyx_v_node2 = __pyx_t_11;
19827  __pyx_t_11.memview = NULL;
19828  __pyx_t_11.data = NULL;
19829 
19830  /* "mprans/MeshSmoothing.pyx":1372
19831  * node1 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],1]]
19832  * node2 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],2]]
19833  * U[0] = node1[0]-node0[0] # <<<<<<<<<<<<<<
19834  * U[1] = node1[1]-node0[1]
19835  * U[2] = node1[2]-node0[2]
19836  */
19837  __pyx_t_20 = 0;
19838  if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_node1.shape[0];
19839  __pyx_t_21 = 0;
19840  if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_node0.shape[0];
19841  (__pyx_v_U[0]) = ((*((double *) ( /* dim=0 */ (__pyx_v_node1.data + __pyx_t_20 * __pyx_v_node1.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_node0.data + __pyx_t_21 * __pyx_v_node0.strides[0]) ))));
19842 
19843  /* "mprans/MeshSmoothing.pyx":1373
19844  * node2 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],2]]
19845  * U[0] = node1[0]-node0[0]
19846  * U[1] = node1[1]-node0[1] # <<<<<<<<<<<<<<
19847  * U[2] = node1[2]-node0[2]
19848  * V[0] = node2[0]-node0[0]
19849  */
19850  __pyx_t_22 = 1;
19851  if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_node1.shape[0];
19852  __pyx_t_23 = 1;
19853  if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_node0.shape[0];
19854  (__pyx_v_U[1]) = ((*((double *) ( /* dim=0 */ (__pyx_v_node1.data + __pyx_t_22 * __pyx_v_node1.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_node0.data + __pyx_t_23 * __pyx_v_node0.strides[0]) ))));
19855 
19856  /* "mprans/MeshSmoothing.pyx":1374
19857  * U[0] = node1[0]-node0[0]
19858  * U[1] = node1[1]-node0[1]
19859  * U[2] = node1[2]-node0[2] # <<<<<<<<<<<<<<
19860  * V[0] = node2[0]-node0[0]
19861  * V[1] = node2[1]-node0[1]
19862  */
19863  __pyx_t_24 = 2;
19864  if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_node1.shape[0];
19865  __pyx_t_25 = 2;
19866  if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_node0.shape[0];
19867  (__pyx_v_U[2]) = ((*((double *) ( /* dim=0 */ (__pyx_v_node1.data + __pyx_t_24 * __pyx_v_node1.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_node0.data + __pyx_t_25 * __pyx_v_node0.strides[0]) ))));
19868 
19869  /* "mprans/MeshSmoothing.pyx":1375
19870  * U[1] = node1[1]-node0[1]
19871  * U[2] = node1[2]-node0[2]
19872  * V[0] = node2[0]-node0[0] # <<<<<<<<<<<<<<
19873  * V[1] = node2[1]-node0[1]
19874  * V[2] = node2[2]-node0[2]
19875  */
19876  __pyx_t_26 = 0;
19877  if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_node2.shape[0];
19878  __pyx_t_27 = 0;
19879  if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_node0.shape[0];
19880  (__pyx_v_V[0]) = ((*((double *) ( /* dim=0 */ (__pyx_v_node2.data + __pyx_t_26 * __pyx_v_node2.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_node0.data + __pyx_t_27 * __pyx_v_node0.strides[0]) ))));
19881 
19882  /* "mprans/MeshSmoothing.pyx":1376
19883  * U[2] = node1[2]-node0[2]
19884  * V[0] = node2[0]-node0[0]
19885  * V[1] = node2[1]-node0[1] # <<<<<<<<<<<<<<
19886  * V[2] = node2[2]-node0[2]
19887  * elementBoundaryNormalsArray_[i,j,0] = U[1]*V[2]-U[2]*V[1]
19888  */
19889  __pyx_t_28 = 1;
19890  if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_node2.shape[0];
19891  __pyx_t_29 = 1;
19892  if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_node0.shape[0];
19893  (__pyx_v_V[1]) = ((*((double *) ( /* dim=0 */ (__pyx_v_node2.data + __pyx_t_28 * __pyx_v_node2.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_node0.data + __pyx_t_29 * __pyx_v_node0.strides[0]) ))));
19894 
19895  /* "mprans/MeshSmoothing.pyx":1377
19896  * V[0] = node2[0]-node0[0]
19897  * V[1] = node2[1]-node0[1]
19898  * V[2] = node2[2]-node0[2] # <<<<<<<<<<<<<<
19899  * elementBoundaryNormalsArray_[i,j,0] = U[1]*V[2]-U[2]*V[1]
19900  * elementBoundaryNormalsArray_[i,j,1] = U[2]*V[0]-U[0]*V[2]
19901  */
19902  __pyx_t_30 = 2;
19903  if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_node2.shape[0];
19904  __pyx_t_31 = 2;
19905  if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_node0.shape[0];
19906  (__pyx_v_V[2]) = ((*((double *) ( /* dim=0 */ (__pyx_v_node2.data + __pyx_t_30 * __pyx_v_node2.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_node0.data + __pyx_t_31 * __pyx_v_node0.strides[0]) ))));
19907 
19908  /* "mprans/MeshSmoothing.pyx":1378
19909  * V[1] = node2[1]-node0[1]
19910  * V[2] = node2[2]-node0[2]
19911  * elementBoundaryNormalsArray_[i,j,0] = U[1]*V[2]-U[2]*V[1] # <<<<<<<<<<<<<<
19912  * elementBoundaryNormalsArray_[i,j,1] = U[2]*V[0]-U[0]*V[2]
19913  * elementBoundaryNormalsArray_[i,j,2] = U[0]*V[1]-U[1]*V[0]
19914  */
19915  __pyx_t_32 = __pyx_v_i;
19916  __pyx_t_33 = __pyx_v_j;
19917  __pyx_t_34 = 0;
19918  if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
19919  if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
19920  if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
19921  *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_32 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_33 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_34 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) )) = (((__pyx_v_U[1]) * (__pyx_v_V[2])) - ((__pyx_v_U[2]) * (__pyx_v_V[1])));
19922 
19923  /* "mprans/MeshSmoothing.pyx":1379
19924  * V[2] = node2[2]-node0[2]
19925  * elementBoundaryNormalsArray_[i,j,0] = U[1]*V[2]-U[2]*V[1]
19926  * elementBoundaryNormalsArray_[i,j,1] = U[2]*V[0]-U[0]*V[2] # <<<<<<<<<<<<<<
19927  * elementBoundaryNormalsArray_[i,j,2] = U[0]*V[1]-U[1]*V[0]
19928  * lenghtn = sqrt(elementBoundaryNormalsArray_[i,j,0]**2+elementBoundaryNormalsArray_[i,j,1]**2+elementBoundaryNormalsArray_[i,j,2]**2)
19929  */
19930  __pyx_t_35 = __pyx_v_i;
19931  __pyx_t_36 = __pyx_v_j;
19932  __pyx_t_37 = 1;
19933  if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
19934  if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
19935  if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
19936  *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_35 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_36 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_37 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) )) = (((__pyx_v_U[2]) * (__pyx_v_V[0])) - ((__pyx_v_U[0]) * (__pyx_v_V[2])));
19937 
19938  /* "mprans/MeshSmoothing.pyx":1380
19939  * elementBoundaryNormalsArray_[i,j,0] = U[1]*V[2]-U[2]*V[1]
19940  * elementBoundaryNormalsArray_[i,j,1] = U[2]*V[0]-U[0]*V[2]
19941  * elementBoundaryNormalsArray_[i,j,2] = U[0]*V[1]-U[1]*V[0] # <<<<<<<<<<<<<<
19942  * lenghtn = sqrt(elementBoundaryNormalsArray_[i,j,0]**2+elementBoundaryNormalsArray_[i,j,1]**2+elementBoundaryNormalsArray_[i,j,2]**2)
19943  * elementBoundaryNormalsArray_[i,j,0] /= lenghtn
19944  */
19945  __pyx_t_38 = __pyx_v_i;
19946  __pyx_t_39 = __pyx_v_j;
19947  __pyx_t_40 = 2;
19948  if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
19949  if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
19950  if (__pyx_t_40 < 0) __pyx_t_40 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
19951  *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_38 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_39 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_40 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) )) = (((__pyx_v_U[0]) * (__pyx_v_V[1])) - ((__pyx_v_U[1]) * (__pyx_v_V[0])));
19952 
19953  /* "mprans/MeshSmoothing.pyx":1381
19954  * elementBoundaryNormalsArray_[i,j,1] = U[2]*V[0]-U[0]*V[2]
19955  * elementBoundaryNormalsArray_[i,j,2] = U[0]*V[1]-U[1]*V[0]
19956  * lenghtn = sqrt(elementBoundaryNormalsArray_[i,j,0]**2+elementBoundaryNormalsArray_[i,j,1]**2+elementBoundaryNormalsArray_[i,j,2]**2) # <<<<<<<<<<<<<<
19957  * elementBoundaryNormalsArray_[i,j,0] /= lenghtn
19958  * elementBoundaryNormalsArray_[i,j,1] /= lenghtn
19959  */
19960  __pyx_t_41 = __pyx_v_i;
19961  __pyx_t_42 = __pyx_v_j;
19962  __pyx_t_43 = 0;
19963  if (__pyx_t_41 < 0) __pyx_t_41 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
19964  if (__pyx_t_42 < 0) __pyx_t_42 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
19965  if (__pyx_t_43 < 0) __pyx_t_43 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
19966  __pyx_t_44 = __pyx_v_i;
19967  __pyx_t_45 = __pyx_v_j;
19968  __pyx_t_46 = 1;
19969  if (__pyx_t_44 < 0) __pyx_t_44 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
19970  if (__pyx_t_45 < 0) __pyx_t_45 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
19971  if (__pyx_t_46 < 0) __pyx_t_46 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
19972  __pyx_t_47 = __pyx_v_i;
19973  __pyx_t_48 = __pyx_v_j;
19974  __pyx_t_49 = 2;
19975  if (__pyx_t_47 < 0) __pyx_t_47 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
19976  if (__pyx_t_48 < 0) __pyx_t_48 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
19977  if (__pyx_t_49 < 0) __pyx_t_49 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
19978  __pyx_v_lenghtn = sqrt(((pow((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_41 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_42 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_43 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) ))), 2.0) + pow((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_44 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_45 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_46 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) ))), 2.0)) + pow((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_47 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_48 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_49 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) ))), 2.0)));
19979 
19980  /* "mprans/MeshSmoothing.pyx":1382
19981  * elementBoundaryNormalsArray_[i,j,2] = U[0]*V[1]-U[1]*V[0]
19982  * lenghtn = sqrt(elementBoundaryNormalsArray_[i,j,0]**2+elementBoundaryNormalsArray_[i,j,1]**2+elementBoundaryNormalsArray_[i,j,2]**2)
19983  * elementBoundaryNormalsArray_[i,j,0] /= lenghtn # <<<<<<<<<<<<<<
19984  * elementBoundaryNormalsArray_[i,j,1] /= lenghtn
19985  * elementBoundaryNormalsArray_[i,j,2] /= lenghtn
19986  */
19987  __pyx_t_50 = __pyx_v_i;
19988  __pyx_t_51 = __pyx_v_j;
19989  __pyx_t_52 = 0;
19990  if (__pyx_t_50 < 0) __pyx_t_50 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
19991  if (__pyx_t_51 < 0) __pyx_t_51 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
19992  if (__pyx_t_52 < 0) __pyx_t_52 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
19993  *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_50 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_51 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_52 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) )) /= __pyx_v_lenghtn;
19994 
19995  /* "mprans/MeshSmoothing.pyx":1383
19996  * lenghtn = sqrt(elementBoundaryNormalsArray_[i,j,0]**2+elementBoundaryNormalsArray_[i,j,1]**2+elementBoundaryNormalsArray_[i,j,2]**2)
19997  * elementBoundaryNormalsArray_[i,j,0] /= lenghtn
19998  * elementBoundaryNormalsArray_[i,j,1] /= lenghtn # <<<<<<<<<<<<<<
19999  * elementBoundaryNormalsArray_[i,j,2] /= lenghtn
20000  * normal_check[0] = elementBoundaryBarycentersArray[b_i, 0]-elementBarycentersArray[i, 0]
20001  */
20002  __pyx_t_53 = __pyx_v_i;
20003  __pyx_t_54 = __pyx_v_j;
20004  __pyx_t_55 = 1;
20005  if (__pyx_t_53 < 0) __pyx_t_53 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20006  if (__pyx_t_54 < 0) __pyx_t_54 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20007  if (__pyx_t_55 < 0) __pyx_t_55 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20008  *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_53 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_54 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_55 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) )) /= __pyx_v_lenghtn;
20009 
20010  /* "mprans/MeshSmoothing.pyx":1384
20011  * elementBoundaryNormalsArray_[i,j,0] /= lenghtn
20012  * elementBoundaryNormalsArray_[i,j,1] /= lenghtn
20013  * elementBoundaryNormalsArray_[i,j,2] /= lenghtn # <<<<<<<<<<<<<<
20014  * normal_check[0] = elementBoundaryBarycentersArray[b_i, 0]-elementBarycentersArray[i, 0]
20015  * normal_check[1] = elementBoundaryBarycentersArray[b_i, 1]-elementBarycentersArray[i, 1]
20016  */
20017  __pyx_t_56 = __pyx_v_i;
20018  __pyx_t_57 = __pyx_v_j;
20019  __pyx_t_58 = 2;
20020  if (__pyx_t_56 < 0) __pyx_t_56 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20021  if (__pyx_t_57 < 0) __pyx_t_57 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20022  if (__pyx_t_58 < 0) __pyx_t_58 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20023  *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_56 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_57 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_58 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) )) /= __pyx_v_lenghtn;
20024 
20025  /* "mprans/MeshSmoothing.pyx":1385
20026  * elementBoundaryNormalsArray_[i,j,1] /= lenghtn
20027  * elementBoundaryNormalsArray_[i,j,2] /= lenghtn
20028  * normal_check[0] = elementBoundaryBarycentersArray[b_i, 0]-elementBarycentersArray[i, 0] # <<<<<<<<<<<<<<
20029  * normal_check[1] = elementBoundaryBarycentersArray[b_i, 1]-elementBarycentersArray[i, 1]
20030  * normal_check[2] = elementBoundaryBarycentersArray[b_i, 2]-elementBarycentersArray[i, 2]
20031  */
20032  __pyx_t_59 = __pyx_v_b_i;
20033  __pyx_t_60 = 0;
20034  if (__pyx_t_59 < 0) __pyx_t_59 += __pyx_v_elementBoundaryBarycentersArray.shape[0];
20035  if (__pyx_t_60 < 0) __pyx_t_60 += __pyx_v_elementBoundaryBarycentersArray.shape[1];
20036  __pyx_t_61 = __pyx_v_i;
20037  __pyx_t_62 = 0;
20038  if (__pyx_t_61 < 0) __pyx_t_61 += __pyx_v_elementBarycentersArray.shape[0];
20039  if (__pyx_t_62 < 0) __pyx_t_62 += __pyx_v_elementBarycentersArray.shape[1];
20040  (__pyx_v_normal_check[0]) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryBarycentersArray.data + __pyx_t_59 * __pyx_v_elementBoundaryBarycentersArray.strides[0]) ) + __pyx_t_60 * __pyx_v_elementBoundaryBarycentersArray.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray.data + __pyx_t_61 * __pyx_v_elementBarycentersArray.strides[0]) ) + __pyx_t_62 * __pyx_v_elementBarycentersArray.strides[1]) ))));
20041 
20042  /* "mprans/MeshSmoothing.pyx":1386
20043  * elementBoundaryNormalsArray_[i,j,2] /= lenghtn
20044  * normal_check[0] = elementBoundaryBarycentersArray[b_i, 0]-elementBarycentersArray[i, 0]
20045  * normal_check[1] = elementBoundaryBarycentersArray[b_i, 1]-elementBarycentersArray[i, 1] # <<<<<<<<<<<<<<
20046  * normal_check[2] = elementBoundaryBarycentersArray[b_i, 2]-elementBarycentersArray[i, 2]
20047  * dot = elementBoundaryNormalsArray_[i,j,0]*normal_check[0]+\
20048  */
20049  __pyx_t_63 = __pyx_v_b_i;
20050  __pyx_t_64 = 1;
20051  if (__pyx_t_63 < 0) __pyx_t_63 += __pyx_v_elementBoundaryBarycentersArray.shape[0];
20052  if (__pyx_t_64 < 0) __pyx_t_64 += __pyx_v_elementBoundaryBarycentersArray.shape[1];
20053  __pyx_t_65 = __pyx_v_i;
20054  __pyx_t_66 = 1;
20055  if (__pyx_t_65 < 0) __pyx_t_65 += __pyx_v_elementBarycentersArray.shape[0];
20056  if (__pyx_t_66 < 0) __pyx_t_66 += __pyx_v_elementBarycentersArray.shape[1];
20057  (__pyx_v_normal_check[1]) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryBarycentersArray.data + __pyx_t_63 * __pyx_v_elementBoundaryBarycentersArray.strides[0]) ) + __pyx_t_64 * __pyx_v_elementBoundaryBarycentersArray.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray.data + __pyx_t_65 * __pyx_v_elementBarycentersArray.strides[0]) ) + __pyx_t_66 * __pyx_v_elementBarycentersArray.strides[1]) ))));
20058 
20059  /* "mprans/MeshSmoothing.pyx":1387
20060  * normal_check[0] = elementBoundaryBarycentersArray[b_i, 0]-elementBarycentersArray[i, 0]
20061  * normal_check[1] = elementBoundaryBarycentersArray[b_i, 1]-elementBarycentersArray[i, 1]
20062  * normal_check[2] = elementBoundaryBarycentersArray[b_i, 2]-elementBarycentersArray[i, 2] # <<<<<<<<<<<<<<
20063  * dot = elementBoundaryNormalsArray_[i,j,0]*normal_check[0]+\
20064  * elementBoundaryNormalsArray_[i,j,1]*normal_check[1]+\
20065  */
20066  __pyx_t_67 = __pyx_v_b_i;
20067  __pyx_t_68 = 2;
20068  if (__pyx_t_67 < 0) __pyx_t_67 += __pyx_v_elementBoundaryBarycentersArray.shape[0];
20069  if (__pyx_t_68 < 0) __pyx_t_68 += __pyx_v_elementBoundaryBarycentersArray.shape[1];
20070  __pyx_t_69 = __pyx_v_i;
20071  __pyx_t_70 = 2;
20072  if (__pyx_t_69 < 0) __pyx_t_69 += __pyx_v_elementBarycentersArray.shape[0];
20073  if (__pyx_t_70 < 0) __pyx_t_70 += __pyx_v_elementBarycentersArray.shape[1];
20074  (__pyx_v_normal_check[2]) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryBarycentersArray.data + __pyx_t_67 * __pyx_v_elementBoundaryBarycentersArray.strides[0]) ) + __pyx_t_68 * __pyx_v_elementBoundaryBarycentersArray.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray.data + __pyx_t_69 * __pyx_v_elementBarycentersArray.strides[0]) ) + __pyx_t_70 * __pyx_v_elementBarycentersArray.strides[1]) ))));
20075 
20076  /* "mprans/MeshSmoothing.pyx":1388
20077  * normal_check[1] = elementBoundaryBarycentersArray[b_i, 1]-elementBarycentersArray[i, 1]
20078  * normal_check[2] = elementBoundaryBarycentersArray[b_i, 2]-elementBarycentersArray[i, 2]
20079  * dot = elementBoundaryNormalsArray_[i,j,0]*normal_check[0]+\ # <<<<<<<<<<<<<<
20080  * elementBoundaryNormalsArray_[i,j,1]*normal_check[1]+\
20081  * elementBoundaryNormalsArray_[i,j,2]*normal_check[2]
20082  */
20083  __pyx_t_71 = __pyx_v_i;
20084  __pyx_t_72 = __pyx_v_j;
20085  __pyx_t_73 = 0;
20086  if (__pyx_t_71 < 0) __pyx_t_71 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20087  if (__pyx_t_72 < 0) __pyx_t_72 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20088  if (__pyx_t_73 < 0) __pyx_t_73 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20089 
20090  /* "mprans/MeshSmoothing.pyx":1389
20091  * normal_check[2] = elementBoundaryBarycentersArray[b_i, 2]-elementBarycentersArray[i, 2]
20092  * dot = elementBoundaryNormalsArray_[i,j,0]*normal_check[0]+\
20093  * elementBoundaryNormalsArray_[i,j,1]*normal_check[1]+\ # <<<<<<<<<<<<<<
20094  * elementBoundaryNormalsArray_[i,j,2]*normal_check[2]
20095  * if dot < 0:
20096  */
20097  __pyx_t_74 = __pyx_v_i;
20098  __pyx_t_75 = __pyx_v_j;
20099  __pyx_t_76 = 1;
20100  if (__pyx_t_74 < 0) __pyx_t_74 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20101  if (__pyx_t_75 < 0) __pyx_t_75 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20102  if (__pyx_t_76 < 0) __pyx_t_76 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20103 
20104  /* "mprans/MeshSmoothing.pyx":1390
20105  * dot = elementBoundaryNormalsArray_[i,j,0]*normal_check[0]+\
20106  * elementBoundaryNormalsArray_[i,j,1]*normal_check[1]+\
20107  * elementBoundaryNormalsArray_[i,j,2]*normal_check[2] # <<<<<<<<<<<<<<
20108  * if dot < 0:
20109  * elementBoundaryNormalsArray_[i,j,0] = -elementBoundaryNormalsArray_[i,j,0]
20110  */
20111  __pyx_t_77 = __pyx_v_i;
20112  __pyx_t_78 = __pyx_v_j;
20113  __pyx_t_79 = 2;
20114  if (__pyx_t_77 < 0) __pyx_t_77 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20115  if (__pyx_t_78 < 0) __pyx_t_78 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20116  if (__pyx_t_79 < 0) __pyx_t_79 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20117 
20118  /* "mprans/MeshSmoothing.pyx":1389
20119  * normal_check[2] = elementBoundaryBarycentersArray[b_i, 2]-elementBarycentersArray[i, 2]
20120  * dot = elementBoundaryNormalsArray_[i,j,0]*normal_check[0]+\
20121  * elementBoundaryNormalsArray_[i,j,1]*normal_check[1]+\ # <<<<<<<<<<<<<<
20122  * elementBoundaryNormalsArray_[i,j,2]*normal_check[2]
20123  * if dot < 0:
20124  */
20125  __pyx_v_dot = ((((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_71 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_72 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_73 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) ))) * (__pyx_v_normal_check[0])) + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_74 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_75 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_76 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) ))) * (__pyx_v_normal_check[1]))) + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_77 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_78 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_79 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) ))) * (__pyx_v_normal_check[2])));
20126 
20127  /* "mprans/MeshSmoothing.pyx":1391
20128  * elementBoundaryNormalsArray_[i,j,1]*normal_check[1]+\
20129  * elementBoundaryNormalsArray_[i,j,2]*normal_check[2]
20130  * if dot < 0: # <<<<<<<<<<<<<<
20131  * elementBoundaryNormalsArray_[i,j,0] = -elementBoundaryNormalsArray_[i,j,0]
20132  * elementBoundaryNormalsArray_[i,j,1] = -elementBoundaryNormalsArray_[i,j,1]
20133  */
20134  __pyx_t_80 = ((__pyx_v_dot < 0.0) != 0);
20135  if (__pyx_t_80) {
20136 
20137  /* "mprans/MeshSmoothing.pyx":1392
20138  * elementBoundaryNormalsArray_[i,j,2]*normal_check[2]
20139  * if dot < 0:
20140  * elementBoundaryNormalsArray_[i,j,0] = -elementBoundaryNormalsArray_[i,j,0] # <<<<<<<<<<<<<<
20141  * elementBoundaryNormalsArray_[i,j,1] = -elementBoundaryNormalsArray_[i,j,1]
20142  * elementBoundaryNormalsArray_[i,j,2] = -elementBoundaryNormalsArray_[i,j,2]
20143  */
20144  __pyx_t_81 = __pyx_v_i;
20145  __pyx_t_82 = __pyx_v_j;
20146  __pyx_t_83 = 0;
20147  if (__pyx_t_81 < 0) __pyx_t_81 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20148  if (__pyx_t_82 < 0) __pyx_t_82 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20149  if (__pyx_t_83 < 0) __pyx_t_83 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20150  __pyx_t_84 = __pyx_v_i;
20151  __pyx_t_85 = __pyx_v_j;
20152  __pyx_t_86 = 0;
20153  if (__pyx_t_84 < 0) __pyx_t_84 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20154  if (__pyx_t_85 < 0) __pyx_t_85 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20155  if (__pyx_t_86 < 0) __pyx_t_86 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20156  *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_84 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_85 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_86 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) )) = (-(*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_81 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_82 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_83 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) ))));
20157 
20158  /* "mprans/MeshSmoothing.pyx":1393
20159  * if dot < 0:
20160  * elementBoundaryNormalsArray_[i,j,0] = -elementBoundaryNormalsArray_[i,j,0]
20161  * elementBoundaryNormalsArray_[i,j,1] = -elementBoundaryNormalsArray_[i,j,1] # <<<<<<<<<<<<<<
20162  * elementBoundaryNormalsArray_[i,j,2] = -elementBoundaryNormalsArray_[i,j,2]
20163  *
20164  */
20165  __pyx_t_87 = __pyx_v_i;
20166  __pyx_t_88 = __pyx_v_j;
20167  __pyx_t_89 = 1;
20168  if (__pyx_t_87 < 0) __pyx_t_87 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20169  if (__pyx_t_88 < 0) __pyx_t_88 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20170  if (__pyx_t_89 < 0) __pyx_t_89 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20171  __pyx_t_90 = __pyx_v_i;
20172  __pyx_t_91 = __pyx_v_j;
20173  __pyx_t_92 = 1;
20174  if (__pyx_t_90 < 0) __pyx_t_90 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20175  if (__pyx_t_91 < 0) __pyx_t_91 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20176  if (__pyx_t_92 < 0) __pyx_t_92 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20177  *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_90 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_91 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_92 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) )) = (-(*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_87 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_88 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_89 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) ))));
20178 
20179  /* "mprans/MeshSmoothing.pyx":1394
20180  * elementBoundaryNormalsArray_[i,j,0] = -elementBoundaryNormalsArray_[i,j,0]
20181  * elementBoundaryNormalsArray_[i,j,1] = -elementBoundaryNormalsArray_[i,j,1]
20182  * elementBoundaryNormalsArray_[i,j,2] = -elementBoundaryNormalsArray_[i,j,2] # <<<<<<<<<<<<<<
20183  *
20184  * cdef void pyxUpdateElementBoundaryNormalsTriangle(double[:,:,:] elementBoundaryNormalsArray_,
20185  */
20186  __pyx_t_93 = __pyx_v_i;
20187  __pyx_t_94 = __pyx_v_j;
20188  __pyx_t_95 = 2;
20189  if (__pyx_t_93 < 0) __pyx_t_93 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20190  if (__pyx_t_94 < 0) __pyx_t_94 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20191  if (__pyx_t_95 < 0) __pyx_t_95 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20192  __pyx_t_96 = __pyx_v_i;
20193  __pyx_t_97 = __pyx_v_j;
20194  __pyx_t_98 = 2;
20195  if (__pyx_t_96 < 0) __pyx_t_96 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20196  if (__pyx_t_97 < 0) __pyx_t_97 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20197  if (__pyx_t_98 < 0) __pyx_t_98 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20198  *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_96 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_97 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_98 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) )) = (-(*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_93 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_94 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_95 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) ))));
20199 
20200  /* "mprans/MeshSmoothing.pyx":1391
20201  * elementBoundaryNormalsArray_[i,j,1]*normal_check[1]+\
20202  * elementBoundaryNormalsArray_[i,j,2]*normal_check[2]
20203  * if dot < 0: # <<<<<<<<<<<<<<
20204  * elementBoundaryNormalsArray_[i,j,0] = -elementBoundaryNormalsArray_[i,j,0]
20205  * elementBoundaryNormalsArray_[i,j,1] = -elementBoundaryNormalsArray_[i,j,1]
20206  */
20207  }
20208  }
20209  }
20210 
20211  /* "mprans/MeshSmoothing.pyx":1349
20212  * return nearest_eN
20213  *
20214  * cdef void pyxUpdateElementBoundaryNormalsTetra(double[:,:,:] elementBoundaryNormalsArray_, # <<<<<<<<<<<<<<
20215  * double[:,:] nodeArray,
20216  * int[:,:] elementBoundariesArray,
20217  */
20218 
20219  /* function exit code */
20220  goto __pyx_L0;
20221  __pyx_L1_error:;
20222  __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
20223  __Pyx_WriteUnraisable("mprans.MeshSmoothing.pyxUpdateElementBoundaryNormalsTetra", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
20224  __pyx_L0:;
20225  __PYX_XDEC_MEMVIEW(&__pyx_v_node0, 1);
20226  __PYX_XDEC_MEMVIEW(&__pyx_v_node1, 1);
20227  __PYX_XDEC_MEMVIEW(&__pyx_v_node2, 1);
20228  __Pyx_RefNannyFinishContext();
20229 }
20230 
20231 /* "mprans/MeshSmoothing.pyx":1396
20232  * elementBoundaryNormalsArray_[i,j,2] = -elementBoundaryNormalsArray_[i,j,2]
20233  *
20234  * cdef void pyxUpdateElementBoundaryNormalsTriangle(double[:,:,:] elementBoundaryNormalsArray_, # <<<<<<<<<<<<<<
20235  * double[:,:] nodeArray,
20236  * int[:,:] elementBoundariesArray,
20237  */
20238 
20239 static void __pyx_f_6mprans_13MeshSmoothing_pyxUpdateElementBoundaryNormalsTriangle(__Pyx_memviewslice __pyx_v_elementBoundaryNormalsArray_, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementBoundariesArray, __Pyx_memviewslice __pyx_v_elementBoundaryNodesArray, __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray, __Pyx_memviewslice __pyx_v_elementBarycentersArray, int __pyx_v_nElements) {
20240  double __pyx_v_normal_check[2];
20241  double __pyx_v_U[2];
20242  int __pyx_v_b_i;
20243  __Pyx_memviewslice __pyx_v_node0 = { 0, 0, { 0 }, { 0 }, { 0 } };
20244  __Pyx_memviewslice __pyx_v_node1 = { 0, 0, { 0 }, { 0 }, { 0 } };
20245  int __pyx_v_i;
20246  int __pyx_v_j;
20247  double __pyx_v_dot;
20248  double __pyx_v_lenghtn;
20249  __Pyx_RefNannyDeclarations
20250  int __pyx_t_1;
20251  int __pyx_t_2;
20252  int __pyx_t_3;
20253  int __pyx_t_4;
20254  Py_ssize_t __pyx_t_5;
20255  Py_ssize_t __pyx_t_6;
20256  Py_ssize_t __pyx_t_7;
20257  Py_ssize_t __pyx_t_8;
20258  Py_ssize_t __pyx_t_9;
20259  Py_ssize_t __pyx_t_10;
20260  __Pyx_memviewslice __pyx_t_11 = { 0, 0, { 0 }, { 0 }, { 0 } };
20261  Py_ssize_t __pyx_t_12;
20262  Py_ssize_t __pyx_t_13;
20263  Py_ssize_t __pyx_t_14;
20264  Py_ssize_t __pyx_t_15;
20265  Py_ssize_t __pyx_t_16;
20266  Py_ssize_t __pyx_t_17;
20267  Py_ssize_t __pyx_t_18;
20268  Py_ssize_t __pyx_t_19;
20269  Py_ssize_t __pyx_t_20;
20270  Py_ssize_t __pyx_t_21;
20271  Py_ssize_t __pyx_t_22;
20272  Py_ssize_t __pyx_t_23;
20273  Py_ssize_t __pyx_t_24;
20274  Py_ssize_t __pyx_t_25;
20275  Py_ssize_t __pyx_t_26;
20276  Py_ssize_t __pyx_t_27;
20277  Py_ssize_t __pyx_t_28;
20278  Py_ssize_t __pyx_t_29;
20279  Py_ssize_t __pyx_t_30;
20280  Py_ssize_t __pyx_t_31;
20281  Py_ssize_t __pyx_t_32;
20282  Py_ssize_t __pyx_t_33;
20283  Py_ssize_t __pyx_t_34;
20284  Py_ssize_t __pyx_t_35;
20285  Py_ssize_t __pyx_t_36;
20286  Py_ssize_t __pyx_t_37;
20287  Py_ssize_t __pyx_t_38;
20288  Py_ssize_t __pyx_t_39;
20289  Py_ssize_t __pyx_t_40;
20290  Py_ssize_t __pyx_t_41;
20291  Py_ssize_t __pyx_t_42;
20292  Py_ssize_t __pyx_t_43;
20293  Py_ssize_t __pyx_t_44;
20294  Py_ssize_t __pyx_t_45;
20295  Py_ssize_t __pyx_t_46;
20296  Py_ssize_t __pyx_t_47;
20297  Py_ssize_t __pyx_t_48;
20298  Py_ssize_t __pyx_t_49;
20299  Py_ssize_t __pyx_t_50;
20300  Py_ssize_t __pyx_t_51;
20301  int __pyx_t_52;
20302  Py_ssize_t __pyx_t_53;
20303  Py_ssize_t __pyx_t_54;
20304  Py_ssize_t __pyx_t_55;
20305  Py_ssize_t __pyx_t_56;
20306  Py_ssize_t __pyx_t_57;
20307  Py_ssize_t __pyx_t_58;
20308  Py_ssize_t __pyx_t_59;
20309  Py_ssize_t __pyx_t_60;
20310  Py_ssize_t __pyx_t_61;
20311  Py_ssize_t __pyx_t_62;
20312  Py_ssize_t __pyx_t_63;
20313  Py_ssize_t __pyx_t_64;
20314  __Pyx_RefNannySetupContext("pyxUpdateElementBoundaryNormalsTriangle", 0);
20315 
20316  /* "mprans/MeshSmoothing.pyx":1411
20317  * cdef int j
20318  * cdef double dot
20319  * for i in range(nElements): # <<<<<<<<<<<<<<
20320  * for j in range(3):
20321  * b_i = elementBoundariesArray[i, j]
20322  */
20323  __pyx_t_1 = __pyx_v_nElements;
20324  __pyx_t_2 = __pyx_t_1;
20325  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
20326  __pyx_v_i = __pyx_t_3;
20327 
20328  /* "mprans/MeshSmoothing.pyx":1412
20329  * cdef double dot
20330  * for i in range(nElements):
20331  * for j in range(3): # <<<<<<<<<<<<<<
20332  * b_i = elementBoundariesArray[i, j]
20333  * node0 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],0]]
20334  */
20335  for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) {
20336  __pyx_v_j = __pyx_t_4;
20337 
20338  /* "mprans/MeshSmoothing.pyx":1413
20339  * for i in range(nElements):
20340  * for j in range(3):
20341  * b_i = elementBoundariesArray[i, j] # <<<<<<<<<<<<<<
20342  * node0 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],0]]
20343  * node1 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],1]]
20344  */
20345  __pyx_t_5 = __pyx_v_i;
20346  __pyx_t_6 = __pyx_v_j;
20347  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBoundariesArray.shape[0];
20348  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_elementBoundariesArray.shape[1];
20349  __pyx_v_b_i = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundariesArray.data + __pyx_t_5 * __pyx_v_elementBoundariesArray.strides[0]) ) + __pyx_t_6 * __pyx_v_elementBoundariesArray.strides[1]) )));
20350 
20351  /* "mprans/MeshSmoothing.pyx":1414
20352  * for j in range(3):
20353  * b_i = elementBoundariesArray[i, j]
20354  * node0 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],0]] # <<<<<<<<<<<<<<
20355  * node1 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],1]]
20356  * U[0] = node1[0]-node0[0]
20357  */
20358  __pyx_t_7 = __pyx_v_i;
20359  __pyx_t_8 = __pyx_v_j;
20360  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_elementBoundariesArray.shape[0];
20361  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_elementBoundariesArray.shape[1];
20362  __pyx_t_9 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundariesArray.data + __pyx_t_7 * __pyx_v_elementBoundariesArray.strides[0]) ) + __pyx_t_8 * __pyx_v_elementBoundariesArray.strides[1]) )));
20363  __pyx_t_10 = 0;
20364  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_elementBoundaryNodesArray.shape[0];
20365  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_elementBoundaryNodesArray.shape[1];
20366  __pyx_t_11.data = __pyx_v_nodeArray.data;
20367  __pyx_t_11.memview = __pyx_v_nodeArray.memview;
20368  __PYX_INC_MEMVIEW(&__pyx_t_11, 0);
20369  {
20370  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNodesArray.data + __pyx_t_9 * __pyx_v_elementBoundaryNodesArray.strides[0]) ) + __pyx_t_10 * __pyx_v_elementBoundaryNodesArray.strides[1]) )));
20371  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
20372  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
20373  if (__pyx_tmp_idx < 0)
20374  __pyx_tmp_idx += __pyx_tmp_shape;
20375  if ((0)) __PYX_ERR(0, 1414, __pyx_L1_error)
20376  __pyx_t_11.data += __pyx_tmp_idx * __pyx_tmp_stride;
20377 }
20378 
20379 __pyx_t_11.shape[0] = __pyx_v_nodeArray.shape[1];
20380 __pyx_t_11.strides[0] = __pyx_v_nodeArray.strides[1];
20381  __pyx_t_11.suboffsets[0] = -1;
20382 
20383 __PYX_XDEC_MEMVIEW(&__pyx_v_node0, 1);
20384  __pyx_v_node0 = __pyx_t_11;
20385  __pyx_t_11.memview = NULL;
20386  __pyx_t_11.data = NULL;
20387 
20388  /* "mprans/MeshSmoothing.pyx":1415
20389  * b_i = elementBoundariesArray[i, j]
20390  * node0 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],0]]
20391  * node1 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],1]] # <<<<<<<<<<<<<<
20392  * U[0] = node1[0]-node0[0]
20393  * U[1] = node1[1]-node0[1]
20394  */
20395  __pyx_t_12 = __pyx_v_i;
20396  __pyx_t_13 = __pyx_v_j;
20397  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_elementBoundariesArray.shape[0];
20398  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_elementBoundariesArray.shape[1];
20399  __pyx_t_14 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundariesArray.data + __pyx_t_12 * __pyx_v_elementBoundariesArray.strides[0]) ) + __pyx_t_13 * __pyx_v_elementBoundariesArray.strides[1]) )));
20400  __pyx_t_15 = 1;
20401  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_elementBoundaryNodesArray.shape[0];
20402  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_elementBoundaryNodesArray.shape[1];
20403  __pyx_t_11.data = __pyx_v_nodeArray.data;
20404  __pyx_t_11.memview = __pyx_v_nodeArray.memview;
20405  __PYX_INC_MEMVIEW(&__pyx_t_11, 0);
20406  {
20407  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNodesArray.data + __pyx_t_14 * __pyx_v_elementBoundaryNodesArray.strides[0]) ) + __pyx_t_15 * __pyx_v_elementBoundaryNodesArray.strides[1]) )));
20408  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
20409  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
20410  if (__pyx_tmp_idx < 0)
20411  __pyx_tmp_idx += __pyx_tmp_shape;
20412  if ((0)) __PYX_ERR(0, 1415, __pyx_L1_error)
20413  __pyx_t_11.data += __pyx_tmp_idx * __pyx_tmp_stride;
20414 }
20415 
20416 __pyx_t_11.shape[0] = __pyx_v_nodeArray.shape[1];
20417 __pyx_t_11.strides[0] = __pyx_v_nodeArray.strides[1];
20418  __pyx_t_11.suboffsets[0] = -1;
20419 
20420 __PYX_XDEC_MEMVIEW(&__pyx_v_node1, 1);
20421  __pyx_v_node1 = __pyx_t_11;
20422  __pyx_t_11.memview = NULL;
20423  __pyx_t_11.data = NULL;
20424 
20425  /* "mprans/MeshSmoothing.pyx":1416
20426  * node0 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],0]]
20427  * node1 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],1]]
20428  * U[0] = node1[0]-node0[0] # <<<<<<<<<<<<<<
20429  * U[1] = node1[1]-node0[1]
20430  * elementBoundaryNormalsArray_[i,j,0] = -U[1]
20431  */
20432  __pyx_t_16 = 0;
20433  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_node1.shape[0];
20434  __pyx_t_17 = 0;
20435  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_node0.shape[0];
20436  (__pyx_v_U[0]) = ((*((double *) ( /* dim=0 */ (__pyx_v_node1.data + __pyx_t_16 * __pyx_v_node1.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_node0.data + __pyx_t_17 * __pyx_v_node0.strides[0]) ))));
20437 
20438  /* "mprans/MeshSmoothing.pyx":1417
20439  * node1 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],1]]
20440  * U[0] = node1[0]-node0[0]
20441  * U[1] = node1[1]-node0[1] # <<<<<<<<<<<<<<
20442  * elementBoundaryNormalsArray_[i,j,0] = -U[1]
20443  * elementBoundaryNormalsArray_[i,j,1] = U[0]
20444  */
20445  __pyx_t_18 = 1;
20446  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_node1.shape[0];
20447  __pyx_t_19 = 1;
20448  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_node0.shape[0];
20449  (__pyx_v_U[1]) = ((*((double *) ( /* dim=0 */ (__pyx_v_node1.data + __pyx_t_18 * __pyx_v_node1.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_node0.data + __pyx_t_19 * __pyx_v_node0.strides[0]) ))));
20450 
20451  /* "mprans/MeshSmoothing.pyx":1418
20452  * U[0] = node1[0]-node0[0]
20453  * U[1] = node1[1]-node0[1]
20454  * elementBoundaryNormalsArray_[i,j,0] = -U[1] # <<<<<<<<<<<<<<
20455  * elementBoundaryNormalsArray_[i,j,1] = U[0]
20456  * lenghtn = sqrt(elementBoundaryNormalsArray_[i,j,0]**2+elementBoundaryNormalsArray_[i,j,1]**2)
20457  */
20458  __pyx_t_20 = __pyx_v_i;
20459  __pyx_t_21 = __pyx_v_j;
20460  __pyx_t_22 = 0;
20461  if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20462  if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20463  if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20464  *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_20 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_21 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_22 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) )) = (-(__pyx_v_U[1]));
20465 
20466  /* "mprans/MeshSmoothing.pyx":1419
20467  * U[1] = node1[1]-node0[1]
20468  * elementBoundaryNormalsArray_[i,j,0] = -U[1]
20469  * elementBoundaryNormalsArray_[i,j,1] = U[0] # <<<<<<<<<<<<<<
20470  * lenghtn = sqrt(elementBoundaryNormalsArray_[i,j,0]**2+elementBoundaryNormalsArray_[i,j,1]**2)
20471  * elementBoundaryNormalsArray_[i,j,0] /= lenghtn
20472  */
20473  __pyx_t_23 = __pyx_v_i;
20474  __pyx_t_24 = __pyx_v_j;
20475  __pyx_t_25 = 1;
20476  if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20477  if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20478  if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20479  *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_23 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_24 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_25 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) )) = (__pyx_v_U[0]);
20480 
20481  /* "mprans/MeshSmoothing.pyx":1420
20482  * elementBoundaryNormalsArray_[i,j,0] = -U[1]
20483  * elementBoundaryNormalsArray_[i,j,1] = U[0]
20484  * lenghtn = sqrt(elementBoundaryNormalsArray_[i,j,0]**2+elementBoundaryNormalsArray_[i,j,1]**2) # <<<<<<<<<<<<<<
20485  * elementBoundaryNormalsArray_[i,j,0] /= lenghtn
20486  * elementBoundaryNormalsArray_[i,j,1] /= lenghtn
20487  */
20488  __pyx_t_26 = __pyx_v_i;
20489  __pyx_t_27 = __pyx_v_j;
20490  __pyx_t_28 = 0;
20491  if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20492  if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20493  if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20494  __pyx_t_29 = __pyx_v_i;
20495  __pyx_t_30 = __pyx_v_j;
20496  __pyx_t_31 = 1;
20497  if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20498  if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20499  if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20500  __pyx_v_lenghtn = sqrt((pow((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_26 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_27 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_28 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) ))), 2.0) + pow((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_29 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_30 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_31 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) ))), 2.0)));
20501 
20502  /* "mprans/MeshSmoothing.pyx":1421
20503  * elementBoundaryNormalsArray_[i,j,1] = U[0]
20504  * lenghtn = sqrt(elementBoundaryNormalsArray_[i,j,0]**2+elementBoundaryNormalsArray_[i,j,1]**2)
20505  * elementBoundaryNormalsArray_[i,j,0] /= lenghtn # <<<<<<<<<<<<<<
20506  * elementBoundaryNormalsArray_[i,j,1] /= lenghtn
20507  * normal_check[0] = elementBoundaryBarycentersArray[b_i, 0]-elementBarycentersArray[i, 0]
20508  */
20509  __pyx_t_32 = __pyx_v_i;
20510  __pyx_t_33 = __pyx_v_j;
20511  __pyx_t_34 = 0;
20512  if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20513  if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20514  if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20515  *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_32 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_33 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_34 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) )) /= __pyx_v_lenghtn;
20516 
20517  /* "mprans/MeshSmoothing.pyx":1422
20518  * lenghtn = sqrt(elementBoundaryNormalsArray_[i,j,0]**2+elementBoundaryNormalsArray_[i,j,1]**2)
20519  * elementBoundaryNormalsArray_[i,j,0] /= lenghtn
20520  * elementBoundaryNormalsArray_[i,j,1] /= lenghtn # <<<<<<<<<<<<<<
20521  * normal_check[0] = elementBoundaryBarycentersArray[b_i, 0]-elementBarycentersArray[i, 0]
20522  * normal_check[1] = elementBoundaryBarycentersArray[b_i, 1]-elementBarycentersArray[i, 1]
20523  */
20524  __pyx_t_35 = __pyx_v_i;
20525  __pyx_t_36 = __pyx_v_j;
20526  __pyx_t_37 = 1;
20527  if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20528  if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20529  if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20530  *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_35 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_36 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_37 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) )) /= __pyx_v_lenghtn;
20531 
20532  /* "mprans/MeshSmoothing.pyx":1423
20533  * elementBoundaryNormalsArray_[i,j,0] /= lenghtn
20534  * elementBoundaryNormalsArray_[i,j,1] /= lenghtn
20535  * normal_check[0] = elementBoundaryBarycentersArray[b_i, 0]-elementBarycentersArray[i, 0] # <<<<<<<<<<<<<<
20536  * normal_check[1] = elementBoundaryBarycentersArray[b_i, 1]-elementBarycentersArray[i, 1]
20537  * dot = elementBoundaryNormalsArray_[i,j,0]*normal_check[0]+\
20538  */
20539  __pyx_t_38 = __pyx_v_b_i;
20540  __pyx_t_39 = 0;
20541  if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_elementBoundaryBarycentersArray.shape[0];
20542  if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_v_elementBoundaryBarycentersArray.shape[1];
20543  __pyx_t_40 = __pyx_v_i;
20544  __pyx_t_41 = 0;
20545  if (__pyx_t_40 < 0) __pyx_t_40 += __pyx_v_elementBarycentersArray.shape[0];
20546  if (__pyx_t_41 < 0) __pyx_t_41 += __pyx_v_elementBarycentersArray.shape[1];
20547  (__pyx_v_normal_check[0]) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryBarycentersArray.data + __pyx_t_38 * __pyx_v_elementBoundaryBarycentersArray.strides[0]) ) + __pyx_t_39 * __pyx_v_elementBoundaryBarycentersArray.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray.data + __pyx_t_40 * __pyx_v_elementBarycentersArray.strides[0]) ) + __pyx_t_41 * __pyx_v_elementBarycentersArray.strides[1]) ))));
20548 
20549  /* "mprans/MeshSmoothing.pyx":1424
20550  * elementBoundaryNormalsArray_[i,j,1] /= lenghtn
20551  * normal_check[0] = elementBoundaryBarycentersArray[b_i, 0]-elementBarycentersArray[i, 0]
20552  * normal_check[1] = elementBoundaryBarycentersArray[b_i, 1]-elementBarycentersArray[i, 1] # <<<<<<<<<<<<<<
20553  * dot = elementBoundaryNormalsArray_[i,j,0]*normal_check[0]+\
20554  * elementBoundaryNormalsArray_[i,j,1]*normal_check[1]
20555  */
20556  __pyx_t_42 = __pyx_v_b_i;
20557  __pyx_t_43 = 1;
20558  if (__pyx_t_42 < 0) __pyx_t_42 += __pyx_v_elementBoundaryBarycentersArray.shape[0];
20559  if (__pyx_t_43 < 0) __pyx_t_43 += __pyx_v_elementBoundaryBarycentersArray.shape[1];
20560  __pyx_t_44 = __pyx_v_i;
20561  __pyx_t_45 = 1;
20562  if (__pyx_t_44 < 0) __pyx_t_44 += __pyx_v_elementBarycentersArray.shape[0];
20563  if (__pyx_t_45 < 0) __pyx_t_45 += __pyx_v_elementBarycentersArray.shape[1];
20564  (__pyx_v_normal_check[1]) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryBarycentersArray.data + __pyx_t_42 * __pyx_v_elementBoundaryBarycentersArray.strides[0]) ) + __pyx_t_43 * __pyx_v_elementBoundaryBarycentersArray.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray.data + __pyx_t_44 * __pyx_v_elementBarycentersArray.strides[0]) ) + __pyx_t_45 * __pyx_v_elementBarycentersArray.strides[1]) ))));
20565 
20566  /* "mprans/MeshSmoothing.pyx":1425
20567  * normal_check[0] = elementBoundaryBarycentersArray[b_i, 0]-elementBarycentersArray[i, 0]
20568  * normal_check[1] = elementBoundaryBarycentersArray[b_i, 1]-elementBarycentersArray[i, 1]
20569  * dot = elementBoundaryNormalsArray_[i,j,0]*normal_check[0]+\ # <<<<<<<<<<<<<<
20570  * elementBoundaryNormalsArray_[i,j,1]*normal_check[1]
20571  * if dot < 0:
20572  */
20573  __pyx_t_46 = __pyx_v_i;
20574  __pyx_t_47 = __pyx_v_j;
20575  __pyx_t_48 = 0;
20576  if (__pyx_t_46 < 0) __pyx_t_46 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20577  if (__pyx_t_47 < 0) __pyx_t_47 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20578  if (__pyx_t_48 < 0) __pyx_t_48 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20579 
20580  /* "mprans/MeshSmoothing.pyx":1426
20581  * normal_check[1] = elementBoundaryBarycentersArray[b_i, 1]-elementBarycentersArray[i, 1]
20582  * dot = elementBoundaryNormalsArray_[i,j,0]*normal_check[0]+\
20583  * elementBoundaryNormalsArray_[i,j,1]*normal_check[1] # <<<<<<<<<<<<<<
20584  * if dot < 0:
20585  * elementBoundaryNormalsArray_[i,j,0] = -elementBoundaryNormalsArray_[i,j,0]
20586  */
20587  __pyx_t_49 = __pyx_v_i;
20588  __pyx_t_50 = __pyx_v_j;
20589  __pyx_t_51 = 1;
20590  if (__pyx_t_49 < 0) __pyx_t_49 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20591  if (__pyx_t_50 < 0) __pyx_t_50 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20592  if (__pyx_t_51 < 0) __pyx_t_51 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20593 
20594  /* "mprans/MeshSmoothing.pyx":1425
20595  * normal_check[0] = elementBoundaryBarycentersArray[b_i, 0]-elementBarycentersArray[i, 0]
20596  * normal_check[1] = elementBoundaryBarycentersArray[b_i, 1]-elementBarycentersArray[i, 1]
20597  * dot = elementBoundaryNormalsArray_[i,j,0]*normal_check[0]+\ # <<<<<<<<<<<<<<
20598  * elementBoundaryNormalsArray_[i,j,1]*normal_check[1]
20599  * if dot < 0:
20600  */
20601  __pyx_v_dot = (((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_46 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_47 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_48 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) ))) * (__pyx_v_normal_check[0])) + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_49 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_50 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_51 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) ))) * (__pyx_v_normal_check[1])));
20602 
20603  /* "mprans/MeshSmoothing.pyx":1427
20604  * dot = elementBoundaryNormalsArray_[i,j,0]*normal_check[0]+\
20605  * elementBoundaryNormalsArray_[i,j,1]*normal_check[1]
20606  * if dot < 0: # <<<<<<<<<<<<<<
20607  * elementBoundaryNormalsArray_[i,j,0] = -elementBoundaryNormalsArray_[i,j,0]
20608  * elementBoundaryNormalsArray_[i,j,1] = -elementBoundaryNormalsArray_[i,j,1]
20609  */
20610  __pyx_t_52 = ((__pyx_v_dot < 0.0) != 0);
20611  if (__pyx_t_52) {
20612 
20613  /* "mprans/MeshSmoothing.pyx":1428
20614  * elementBoundaryNormalsArray_[i,j,1]*normal_check[1]
20615  * if dot < 0:
20616  * elementBoundaryNormalsArray_[i,j,0] = -elementBoundaryNormalsArray_[i,j,0] # <<<<<<<<<<<<<<
20617  * elementBoundaryNormalsArray_[i,j,1] = -elementBoundaryNormalsArray_[i,j,1]
20618  *
20619  */
20620  __pyx_t_53 = __pyx_v_i;
20621  __pyx_t_54 = __pyx_v_j;
20622  __pyx_t_55 = 0;
20623  if (__pyx_t_53 < 0) __pyx_t_53 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20624  if (__pyx_t_54 < 0) __pyx_t_54 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20625  if (__pyx_t_55 < 0) __pyx_t_55 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20626  __pyx_t_56 = __pyx_v_i;
20627  __pyx_t_57 = __pyx_v_j;
20628  __pyx_t_58 = 0;
20629  if (__pyx_t_56 < 0) __pyx_t_56 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20630  if (__pyx_t_57 < 0) __pyx_t_57 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20631  if (__pyx_t_58 < 0) __pyx_t_58 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20632  *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_56 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_57 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_58 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) )) = (-(*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_53 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_54 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_55 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) ))));
20633 
20634  /* "mprans/MeshSmoothing.pyx":1429
20635  * if dot < 0:
20636  * elementBoundaryNormalsArray_[i,j,0] = -elementBoundaryNormalsArray_[i,j,0]
20637  * elementBoundaryNormalsArray_[i,j,1] = -elementBoundaryNormalsArray_[i,j,1] # <<<<<<<<<<<<<<
20638  *
20639  * cdef void cyUpdateElementVolumesTriangle(double[:] elementVolumesArray_,
20640  */
20641  __pyx_t_59 = __pyx_v_i;
20642  __pyx_t_60 = __pyx_v_j;
20643  __pyx_t_61 = 1;
20644  if (__pyx_t_59 < 0) __pyx_t_59 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20645  if (__pyx_t_60 < 0) __pyx_t_60 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20646  if (__pyx_t_61 < 0) __pyx_t_61 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20647  __pyx_t_62 = __pyx_v_i;
20648  __pyx_t_63 = __pyx_v_j;
20649  __pyx_t_64 = 1;
20650  if (__pyx_t_62 < 0) __pyx_t_62 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20651  if (__pyx_t_63 < 0) __pyx_t_63 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20652  if (__pyx_t_64 < 0) __pyx_t_64 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20653  *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_62 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_63 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_64 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) )) = (-(*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_59 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_60 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_61 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) ))));
20654 
20655  /* "mprans/MeshSmoothing.pyx":1427
20656  * dot = elementBoundaryNormalsArray_[i,j,0]*normal_check[0]+\
20657  * elementBoundaryNormalsArray_[i,j,1]*normal_check[1]
20658  * if dot < 0: # <<<<<<<<<<<<<<
20659  * elementBoundaryNormalsArray_[i,j,0] = -elementBoundaryNormalsArray_[i,j,0]
20660  * elementBoundaryNormalsArray_[i,j,1] = -elementBoundaryNormalsArray_[i,j,1]
20661  */
20662  }
20663  }
20664  }
20665 
20666  /* "mprans/MeshSmoothing.pyx":1396
20667  * elementBoundaryNormalsArray_[i,j,2] = -elementBoundaryNormalsArray_[i,j,2]
20668  *
20669  * cdef void pyxUpdateElementBoundaryNormalsTriangle(double[:,:,:] elementBoundaryNormalsArray_, # <<<<<<<<<<<<<<
20670  * double[:,:] nodeArray,
20671  * int[:,:] elementBoundariesArray,
20672  */
20673 
20674  /* function exit code */
20675  goto __pyx_L0;
20676  __pyx_L1_error:;
20677  __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
20678  __Pyx_WriteUnraisable("mprans.MeshSmoothing.pyxUpdateElementBoundaryNormalsTriangle", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
20679  __pyx_L0:;
20680  __PYX_XDEC_MEMVIEW(&__pyx_v_node0, 1);
20681  __PYX_XDEC_MEMVIEW(&__pyx_v_node1, 1);
20682  __Pyx_RefNannyFinishContext();
20683 }
20684 
20685 /* "mprans/MeshSmoothing.pyx":1431
20686  * elementBoundaryNormalsArray_[i,j,1] = -elementBoundaryNormalsArray_[i,j,1]
20687  *
20688  * cdef void cyUpdateElementVolumesTriangle(double[:] elementVolumesArray_, # <<<<<<<<<<<<<<
20689  * int[:,:] elementNodesArray,
20690  * double[:,:] nodeArray,
20691  */
20692 
20693 static void __pyx_f_6mprans_13MeshSmoothing_cyUpdateElementVolumesTriangle(__Pyx_memviewslice __pyx_v_elementVolumesArray_, __Pyx_memviewslice __pyx_v_elementNodesArray, __Pyx_memviewslice __pyx_v_nodeArray, int __pyx_v_nElements) {
20694  __Pyx_memviewslice __pyx_v_nA = { 0, 0, { 0 }, { 0 }, { 0 } };
20695  __Pyx_memviewslice __pyx_v_nB = { 0, 0, { 0 }, { 0 }, { 0 } };
20696  __Pyx_memviewslice __pyx_v_nC = { 0, 0, { 0 }, { 0 }, { 0 } };
20697  double __pyx_v_base;
20698  double __pyx_v_height;
20699  int __pyx_v_eN;
20700  __Pyx_RefNannyDeclarations
20701  int __pyx_t_1;
20702  int __pyx_t_2;
20703  int __pyx_t_3;
20704  Py_ssize_t __pyx_t_4;
20705  Py_ssize_t __pyx_t_5;
20706  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
20707  Py_ssize_t __pyx_t_7;
20708  Py_ssize_t __pyx_t_8;
20709  Py_ssize_t __pyx_t_9;
20710  Py_ssize_t __pyx_t_10;
20711  Py_ssize_t __pyx_t_11;
20712  Py_ssize_t __pyx_t_12;
20713  Py_ssize_t __pyx_t_13;
20714  Py_ssize_t __pyx_t_14;
20715  Py_ssize_t __pyx_t_15;
20716  Py_ssize_t __pyx_t_16;
20717  Py_ssize_t __pyx_t_17;
20718  Py_ssize_t __pyx_t_18;
20719  Py_ssize_t __pyx_t_19;
20720  Py_ssize_t __pyx_t_20;
20721  Py_ssize_t __pyx_t_21;
20722  Py_ssize_t __pyx_t_22;
20723  Py_ssize_t __pyx_t_23;
20724  Py_ssize_t __pyx_t_24;
20725  Py_ssize_t __pyx_t_25;
20726  __Pyx_RefNannySetupContext("cyUpdateElementVolumesTriangle", 0);
20727 
20728  /* "mprans/MeshSmoothing.pyx":1441
20729  * cdef double height
20730  * cdef int eN
20731  * for eN in range(nElements): # <<<<<<<<<<<<<<
20732  * nA = nodeArray[elementNodesArray[eN, 0]]
20733  * nB = nodeArray[elementNodesArray[eN, 1]]
20734  */
20735  __pyx_t_1 = __pyx_v_nElements;
20736  __pyx_t_2 = __pyx_t_1;
20737  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
20738  __pyx_v_eN = __pyx_t_3;
20739 
20740  /* "mprans/MeshSmoothing.pyx":1442
20741  * cdef int eN
20742  * for eN in range(nElements):
20743  * nA = nodeArray[elementNodesArray[eN, 0]] # <<<<<<<<<<<<<<
20744  * nB = nodeArray[elementNodesArray[eN, 1]]
20745  * nC = nodeArray[elementNodesArray[eN, 2]]
20746  */
20747  __pyx_t_4 = __pyx_v_eN;
20748  __pyx_t_5 = 0;
20749  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_elementNodesArray.shape[0];
20750  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementNodesArray.shape[1];
20751  __pyx_t_6.data = __pyx_v_nodeArray.data;
20752  __pyx_t_6.memview = __pyx_v_nodeArray.memview;
20753  __PYX_INC_MEMVIEW(&__pyx_t_6, 0);
20754  {
20755  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_4 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_5 * __pyx_v_elementNodesArray.strides[1]) )));
20756  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
20757  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
20758  if (__pyx_tmp_idx < 0)
20759  __pyx_tmp_idx += __pyx_tmp_shape;
20760  if ((0)) __PYX_ERR(0, 1442, __pyx_L1_error)
20761  __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride;
20762 }
20763 
20764 __pyx_t_6.shape[0] = __pyx_v_nodeArray.shape[1];
20765 __pyx_t_6.strides[0] = __pyx_v_nodeArray.strides[1];
20766  __pyx_t_6.suboffsets[0] = -1;
20767 
20768 __PYX_XDEC_MEMVIEW(&__pyx_v_nA, 1);
20769  __pyx_v_nA = __pyx_t_6;
20770  __pyx_t_6.memview = NULL;
20771  __pyx_t_6.data = NULL;
20772 
20773  /* "mprans/MeshSmoothing.pyx":1443
20774  * for eN in range(nElements):
20775  * nA = nodeArray[elementNodesArray[eN, 0]]
20776  * nB = nodeArray[elementNodesArray[eN, 1]] # <<<<<<<<<<<<<<
20777  * nC = nodeArray[elementNodesArray[eN, 2]]
20778  * base = sqrt((nB[1]-nA[1])**2+(nB[0]-nA[0])**2)
20779  */
20780  __pyx_t_7 = __pyx_v_eN;
20781  __pyx_t_8 = 1;
20782  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_elementNodesArray.shape[0];
20783  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_elementNodesArray.shape[1];
20784  __pyx_t_6.data = __pyx_v_nodeArray.data;
20785  __pyx_t_6.memview = __pyx_v_nodeArray.memview;
20786  __PYX_INC_MEMVIEW(&__pyx_t_6, 0);
20787  {
20788  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_7 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_8 * __pyx_v_elementNodesArray.strides[1]) )));
20789  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
20790  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
20791  if (__pyx_tmp_idx < 0)
20792  __pyx_tmp_idx += __pyx_tmp_shape;
20793  if ((0)) __PYX_ERR(0, 1443, __pyx_L1_error)
20794  __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride;
20795 }
20796 
20797 __pyx_t_6.shape[0] = __pyx_v_nodeArray.shape[1];
20798 __pyx_t_6.strides[0] = __pyx_v_nodeArray.strides[1];
20799  __pyx_t_6.suboffsets[0] = -1;
20800 
20801 __PYX_XDEC_MEMVIEW(&__pyx_v_nB, 1);
20802  __pyx_v_nB = __pyx_t_6;
20803  __pyx_t_6.memview = NULL;
20804  __pyx_t_6.data = NULL;
20805 
20806  /* "mprans/MeshSmoothing.pyx":1444
20807  * nA = nodeArray[elementNodesArray[eN, 0]]
20808  * nB = nodeArray[elementNodesArray[eN, 1]]
20809  * nC = nodeArray[elementNodesArray[eN, 2]] # <<<<<<<<<<<<<<
20810  * base = sqrt((nB[1]-nA[1])**2+(nB[0]-nA[0])**2)
20811  * height = abs((nB[1]-nA[1])*nC[0]-(nB[0]-nA[0])*nC[1]+nB[0]*nA[1]-nB[1]*nA[0])/base
20812  */
20813  __pyx_t_9 = __pyx_v_eN;
20814  __pyx_t_10 = 2;
20815  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_elementNodesArray.shape[0];
20816  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_elementNodesArray.shape[1];
20817  __pyx_t_6.data = __pyx_v_nodeArray.data;
20818  __pyx_t_6.memview = __pyx_v_nodeArray.memview;
20819  __PYX_INC_MEMVIEW(&__pyx_t_6, 0);
20820  {
20821  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_9 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_10 * __pyx_v_elementNodesArray.strides[1]) )));
20822  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
20823  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
20824  if (__pyx_tmp_idx < 0)
20825  __pyx_tmp_idx += __pyx_tmp_shape;
20826  if ((0)) __PYX_ERR(0, 1444, __pyx_L1_error)
20827  __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride;
20828 }
20829 
20830 __pyx_t_6.shape[0] = __pyx_v_nodeArray.shape[1];
20831 __pyx_t_6.strides[0] = __pyx_v_nodeArray.strides[1];
20832  __pyx_t_6.suboffsets[0] = -1;
20833 
20834 __PYX_XDEC_MEMVIEW(&__pyx_v_nC, 1);
20835  __pyx_v_nC = __pyx_t_6;
20836  __pyx_t_6.memview = NULL;
20837  __pyx_t_6.data = NULL;
20838 
20839  /* "mprans/MeshSmoothing.pyx":1445
20840  * nB = nodeArray[elementNodesArray[eN, 1]]
20841  * nC = nodeArray[elementNodesArray[eN, 2]]
20842  * base = sqrt((nB[1]-nA[1])**2+(nB[0]-nA[0])**2) # <<<<<<<<<<<<<<
20843  * height = abs((nB[1]-nA[1])*nC[0]-(nB[0]-nA[0])*nC[1]+nB[0]*nA[1]-nB[1]*nA[0])/base
20844  * elementVolumesArray_[eN] = 0.5*base*height
20845  */
20846  __pyx_t_11 = 1;
20847  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_nB.shape[0];
20848  __pyx_t_12 = 1;
20849  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_nA.shape[0];
20850  __pyx_t_13 = 0;
20851  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_nB.shape[0];
20852  __pyx_t_14 = 0;
20853  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_nA.shape[0];
20854  __pyx_v_base = sqrt((pow(((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_11 * __pyx_v_nB.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_12 * __pyx_v_nA.strides[0]) )))), 2.0) + pow(((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_13 * __pyx_v_nB.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_14 * __pyx_v_nA.strides[0]) )))), 2.0)));
20855 
20856  /* "mprans/MeshSmoothing.pyx":1446
20857  * nC = nodeArray[elementNodesArray[eN, 2]]
20858  * base = sqrt((nB[1]-nA[1])**2+(nB[0]-nA[0])**2)
20859  * height = abs((nB[1]-nA[1])*nC[0]-(nB[0]-nA[0])*nC[1]+nB[0]*nA[1]-nB[1]*nA[0])/base # <<<<<<<<<<<<<<
20860  * elementVolumesArray_[eN] = 0.5*base*height
20861  *
20862  */
20863  __pyx_t_15 = 1;
20864  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_nB.shape[0];
20865  __pyx_t_16 = 1;
20866  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nA.shape[0];
20867  __pyx_t_17 = 0;
20868  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_nC.shape[0];
20869  __pyx_t_18 = 0;
20870  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_nB.shape[0];
20871  __pyx_t_19 = 0;
20872  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_nA.shape[0];
20873  __pyx_t_20 = 1;
20874  if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_nC.shape[0];
20875  __pyx_t_21 = 0;
20876  if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_nB.shape[0];
20877  __pyx_t_22 = 1;
20878  if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_nA.shape[0];
20879  __pyx_t_23 = 1;
20880  if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_nB.shape[0];
20881  __pyx_t_24 = 0;
20882  if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_nA.shape[0];
20883  __pyx_v_height = (fabs(((((((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_15 * __pyx_v_nB.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_16 * __pyx_v_nA.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_nC.data + __pyx_t_17 * __pyx_v_nC.strides[0]) )))) - (((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_18 * __pyx_v_nB.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_19 * __pyx_v_nA.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_nC.data + __pyx_t_20 * __pyx_v_nC.strides[0]) ))))) + ((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_21 * __pyx_v_nB.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_22 * __pyx_v_nA.strides[0]) ))))) - ((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_23 * __pyx_v_nB.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_24 * __pyx_v_nA.strides[0]) )))))) / __pyx_v_base);
20884 
20885  /* "mprans/MeshSmoothing.pyx":1447
20886  * base = sqrt((nB[1]-nA[1])**2+(nB[0]-nA[0])**2)
20887  * height = abs((nB[1]-nA[1])*nC[0]-(nB[0]-nA[0])*nC[1]+nB[0]*nA[1]-nB[1]*nA[0])/base
20888  * elementVolumesArray_[eN] = 0.5*base*height # <<<<<<<<<<<<<<
20889  *
20890  * cdef double cyGetElementVolumeTriangle(double[:] nA,
20891  */
20892  __pyx_t_25 = __pyx_v_eN;
20893  if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_elementVolumesArray_.shape[0];
20894  *((double *) ( /* dim=0 */ (__pyx_v_elementVolumesArray_.data + __pyx_t_25 * __pyx_v_elementVolumesArray_.strides[0]) )) = ((0.5 * __pyx_v_base) * __pyx_v_height);
20895  }
20896 
20897  /* "mprans/MeshSmoothing.pyx":1431
20898  * elementBoundaryNormalsArray_[i,j,1] = -elementBoundaryNormalsArray_[i,j,1]
20899  *
20900  * cdef void cyUpdateElementVolumesTriangle(double[:] elementVolumesArray_, # <<<<<<<<<<<<<<
20901  * int[:,:] elementNodesArray,
20902  * double[:,:] nodeArray,
20903  */
20904 
20905  /* function exit code */
20906  goto __pyx_L0;
20907  __pyx_L1_error:;
20908  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
20909  __Pyx_WriteUnraisable("mprans.MeshSmoothing.cyUpdateElementVolumesTriangle", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
20910  __pyx_L0:;
20911  __PYX_XDEC_MEMVIEW(&__pyx_v_nA, 1);
20912  __PYX_XDEC_MEMVIEW(&__pyx_v_nB, 1);
20913  __PYX_XDEC_MEMVIEW(&__pyx_v_nC, 1);
20914  __Pyx_RefNannyFinishContext();
20915 }
20916 
20917 /* "mprans/MeshSmoothing.pyx":1449
20918  * elementVolumesArray_[eN] = 0.5*base*height
20919  *
20920  * cdef double cyGetElementVolumeTriangle(double[:] nA, # <<<<<<<<<<<<<<
20921  * double[:] nB,
20922  * double[:] nC):
20923  */
20924 
20925 static double __pyx_f_6mprans_13MeshSmoothing_cyGetElementVolumeTriangle(__Pyx_memviewslice __pyx_v_nA, __Pyx_memviewslice __pyx_v_nB, __Pyx_memviewslice __pyx_v_nC) {
20926  double __pyx_v_base;
20927  double __pyx_v_height;
20928  double __pyx_r;
20929  __Pyx_RefNannyDeclarations
20930  Py_ssize_t __pyx_t_1;
20931  Py_ssize_t __pyx_t_2;
20932  Py_ssize_t __pyx_t_3;
20933  Py_ssize_t __pyx_t_4;
20934  Py_ssize_t __pyx_t_5;
20935  Py_ssize_t __pyx_t_6;
20936  Py_ssize_t __pyx_t_7;
20937  Py_ssize_t __pyx_t_8;
20938  Py_ssize_t __pyx_t_9;
20939  Py_ssize_t __pyx_t_10;
20940  Py_ssize_t __pyx_t_11;
20941  Py_ssize_t __pyx_t_12;
20942  Py_ssize_t __pyx_t_13;
20943  Py_ssize_t __pyx_t_14;
20944  __Pyx_RefNannySetupContext("cyGetElementVolumeTriangle", 0);
20945 
20946  /* "mprans/MeshSmoothing.pyx":1452
20947  * double[:] nB,
20948  * double[:] nC):
20949  * cdef double base = sqrt((nB[1]-nA[1])**2+(nB[0]-nA[0])**2) # <<<<<<<<<<<<<<
20950  * cdef double height = abs((nB[1]-nA[1])*nC[0]-(nB[0]-nA[0])*nC[1]+nB[0]*nA[1]-nB[1]*nA[0])/base
20951  * return 0.5*base*height
20952  */
20953  __pyx_t_1 = 1;
20954  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_nB.shape[0];
20955  __pyx_t_2 = 1;
20956  if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_nA.shape[0];
20957  __pyx_t_3 = 0;
20958  if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_nB.shape[0];
20959  __pyx_t_4 = 0;
20960  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_nA.shape[0];
20961  __pyx_v_base = sqrt((pow(((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_1 * __pyx_v_nB.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_2 * __pyx_v_nA.strides[0]) )))), 2.0) + pow(((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_3 * __pyx_v_nB.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_4 * __pyx_v_nA.strides[0]) )))), 2.0)));
20962 
20963  /* "mprans/MeshSmoothing.pyx":1453
20964  * double[:] nC):
20965  * cdef double base = sqrt((nB[1]-nA[1])**2+(nB[0]-nA[0])**2)
20966  * cdef double height = abs((nB[1]-nA[1])*nC[0]-(nB[0]-nA[0])*nC[1]+nB[0]*nA[1]-nB[1]*nA[0])/base # <<<<<<<<<<<<<<
20967  * return 0.5*base*height
20968  *
20969  */
20970  __pyx_t_5 = 1;
20971  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_nB.shape[0];
20972  __pyx_t_6 = 1;
20973  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_nA.shape[0];
20974  __pyx_t_7 = 0;
20975  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_nC.shape[0];
20976  __pyx_t_8 = 0;
20977  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_nB.shape[0];
20978  __pyx_t_9 = 0;
20979  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_nA.shape[0];
20980  __pyx_t_10 = 1;
20981  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_nC.shape[0];
20982  __pyx_t_11 = 0;
20983  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_nB.shape[0];
20984  __pyx_t_12 = 1;
20985  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_nA.shape[0];
20986  __pyx_t_13 = 1;
20987  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_nB.shape[0];
20988  __pyx_t_14 = 0;
20989  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_nA.shape[0];
20990  __pyx_v_height = (fabs(((((((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_5 * __pyx_v_nB.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_6 * __pyx_v_nA.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_nC.data + __pyx_t_7 * __pyx_v_nC.strides[0]) )))) - (((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_8 * __pyx_v_nB.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_9 * __pyx_v_nA.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_nC.data + __pyx_t_10 * __pyx_v_nC.strides[0]) ))))) + ((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_11 * __pyx_v_nB.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_12 * __pyx_v_nA.strides[0]) ))))) - ((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_13 * __pyx_v_nB.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_14 * __pyx_v_nA.strides[0]) )))))) / __pyx_v_base);
20991 
20992  /* "mprans/MeshSmoothing.pyx":1454
20993  * cdef double base = sqrt((nB[1]-nA[1])**2+(nB[0]-nA[0])**2)
20994  * cdef double height = abs((nB[1]-nA[1])*nC[0]-(nB[0]-nA[0])*nC[1]+nB[0]*nA[1]-nB[1]*nA[0])/base
20995  * return 0.5*base*height # <<<<<<<<<<<<<<
20996  *
20997  * cdef void cyUpdateElementVolumesTetra(double[:] elementVolumesArray_,
20998  */
20999  __pyx_r = ((0.5 * __pyx_v_base) * __pyx_v_height);
21000  goto __pyx_L0;
21001 
21002  /* "mprans/MeshSmoothing.pyx":1449
21003  * elementVolumesArray_[eN] = 0.5*base*height
21004  *
21005  * cdef double cyGetElementVolumeTriangle(double[:] nA, # <<<<<<<<<<<<<<
21006  * double[:] nB,
21007  * double[:] nC):
21008  */
21009 
21010  /* function exit code */
21011  __pyx_L0:;
21012  __Pyx_RefNannyFinishContext();
21013  return __pyx_r;
21014 }
21015 
21016 /* "mprans/MeshSmoothing.pyx":1456
21017  * return 0.5*base*height
21018  *
21019  * cdef void cyUpdateElementVolumesTetra(double[:] elementVolumesArray_, # <<<<<<<<<<<<<<
21020  * int[:,:] elementNodesArray,
21021  * double[:,:] nodeArray,
21022  */
21023 
21024 static void __pyx_f_6mprans_13MeshSmoothing_cyUpdateElementVolumesTetra(__Pyx_memviewslice __pyx_v_elementVolumesArray_, __Pyx_memviewslice __pyx_v_elementNodesArray, __Pyx_memviewslice __pyx_v_nodeArray, int __pyx_v_nElements) {
21025  __Pyx_memviewslice __pyx_v_nA = { 0, 0, { 0 }, { 0 }, { 0 } };
21026  __Pyx_memviewslice __pyx_v_nB = { 0, 0, { 0 }, { 0 }, { 0 } };
21027  __Pyx_memviewslice __pyx_v_nC = { 0, 0, { 0 }, { 0 }, { 0 } };
21028  CYTHON_UNUSED __Pyx_memviewslice __pyx_v_nD = { 0, 0, { 0 }, { 0 }, { 0 } };
21029  double __pyx_v_base_tri;
21030  double __pyx_v_height_tri;
21031  double __pyx_v_area_tri;
21032  double __pyx_v_height_tetra;
21033  int __pyx_v_eN;
21034  __Pyx_RefNannyDeclarations
21035  int __pyx_t_1;
21036  int __pyx_t_2;
21037  int __pyx_t_3;
21038  Py_ssize_t __pyx_t_4;
21039  Py_ssize_t __pyx_t_5;
21040  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
21041  Py_ssize_t __pyx_t_7;
21042  Py_ssize_t __pyx_t_8;
21043  Py_ssize_t __pyx_t_9;
21044  Py_ssize_t __pyx_t_10;
21045  Py_ssize_t __pyx_t_11;
21046  Py_ssize_t __pyx_t_12;
21047  Py_ssize_t __pyx_t_13;
21048  Py_ssize_t __pyx_t_14;
21049  Py_ssize_t __pyx_t_15;
21050  Py_ssize_t __pyx_t_16;
21051  Py_ssize_t __pyx_t_17;
21052  Py_ssize_t __pyx_t_18;
21053  Py_ssize_t __pyx_t_19;
21054  Py_ssize_t __pyx_t_20;
21055  Py_ssize_t __pyx_t_21;
21056  Py_ssize_t __pyx_t_22;
21057  Py_ssize_t __pyx_t_23;
21058  Py_ssize_t __pyx_t_24;
21059  Py_ssize_t __pyx_t_25;
21060  Py_ssize_t __pyx_t_26;
21061  Py_ssize_t __pyx_t_27;
21062  __Pyx_RefNannySetupContext("cyUpdateElementVolumesTetra", 0);
21063 
21064  /* "mprans/MeshSmoothing.pyx":1469
21065  * cdef double height_tetra
21066  * cdef int eN
21067  * for eN in range(nElements): # <<<<<<<<<<<<<<
21068  * nA = nodeArray[elementNodesArray[eN, 0]]
21069  * nB = nodeArray[elementNodesArray[eN, 1]]
21070  */
21071  __pyx_t_1 = __pyx_v_nElements;
21072  __pyx_t_2 = __pyx_t_1;
21073  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
21074  __pyx_v_eN = __pyx_t_3;
21075 
21076  /* "mprans/MeshSmoothing.pyx":1470
21077  * cdef int eN
21078  * for eN in range(nElements):
21079  * nA = nodeArray[elementNodesArray[eN, 0]] # <<<<<<<<<<<<<<
21080  * nB = nodeArray[elementNodesArray[eN, 1]]
21081  * nC = nodeArray[elementNodesArray[eN, 2]]
21082  */
21083  __pyx_t_4 = __pyx_v_eN;
21084  __pyx_t_5 = 0;
21085  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_elementNodesArray.shape[0];
21086  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementNodesArray.shape[1];
21087  __pyx_t_6.data = __pyx_v_nodeArray.data;
21088  __pyx_t_6.memview = __pyx_v_nodeArray.memview;
21089  __PYX_INC_MEMVIEW(&__pyx_t_6, 0);
21090  {
21091  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_4 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_5 * __pyx_v_elementNodesArray.strides[1]) )));
21092  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
21093  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
21094  if (__pyx_tmp_idx < 0)
21095  __pyx_tmp_idx += __pyx_tmp_shape;
21096  if ((0)) __PYX_ERR(0, 1470, __pyx_L1_error)
21097  __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride;
21098 }
21099 
21100 __pyx_t_6.shape[0] = __pyx_v_nodeArray.shape[1];
21101 __pyx_t_6.strides[0] = __pyx_v_nodeArray.strides[1];
21102  __pyx_t_6.suboffsets[0] = -1;
21103 
21104 __PYX_XDEC_MEMVIEW(&__pyx_v_nA, 1);
21105  __pyx_v_nA = __pyx_t_6;
21106  __pyx_t_6.memview = NULL;
21107  __pyx_t_6.data = NULL;
21108 
21109  /* "mprans/MeshSmoothing.pyx":1471
21110  * for eN in range(nElements):
21111  * nA = nodeArray[elementNodesArray[eN, 0]]
21112  * nB = nodeArray[elementNodesArray[eN, 1]] # <<<<<<<<<<<<<<
21113  * nC = nodeArray[elementNodesArray[eN, 2]]
21114  * nD = nodeArray[elementNodesArray[eN, 3]]
21115  */
21116  __pyx_t_7 = __pyx_v_eN;
21117  __pyx_t_8 = 1;
21118  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_elementNodesArray.shape[0];
21119  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_elementNodesArray.shape[1];
21120  __pyx_t_6.data = __pyx_v_nodeArray.data;
21121  __pyx_t_6.memview = __pyx_v_nodeArray.memview;
21122  __PYX_INC_MEMVIEW(&__pyx_t_6, 0);
21123  {
21124  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_7 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_8 * __pyx_v_elementNodesArray.strides[1]) )));
21125  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
21126  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
21127  if (__pyx_tmp_idx < 0)
21128  __pyx_tmp_idx += __pyx_tmp_shape;
21129  if ((0)) __PYX_ERR(0, 1471, __pyx_L1_error)
21130  __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride;
21131 }
21132 
21133 __pyx_t_6.shape[0] = __pyx_v_nodeArray.shape[1];
21134 __pyx_t_6.strides[0] = __pyx_v_nodeArray.strides[1];
21135  __pyx_t_6.suboffsets[0] = -1;
21136 
21137 __PYX_XDEC_MEMVIEW(&__pyx_v_nB, 1);
21138  __pyx_v_nB = __pyx_t_6;
21139  __pyx_t_6.memview = NULL;
21140  __pyx_t_6.data = NULL;
21141 
21142  /* "mprans/MeshSmoothing.pyx":1472
21143  * nA = nodeArray[elementNodesArray[eN, 0]]
21144  * nB = nodeArray[elementNodesArray[eN, 1]]
21145  * nC = nodeArray[elementNodesArray[eN, 2]] # <<<<<<<<<<<<<<
21146  * nD = nodeArray[elementNodesArray[eN, 3]]
21147  * base_tri = sqrt((nB[1]-nA[1])**2+(nB[0]-nA[0])**2)
21148  */
21149  __pyx_t_9 = __pyx_v_eN;
21150  __pyx_t_10 = 2;
21151  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_elementNodesArray.shape[0];
21152  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_elementNodesArray.shape[1];
21153  __pyx_t_6.data = __pyx_v_nodeArray.data;
21154  __pyx_t_6.memview = __pyx_v_nodeArray.memview;
21155  __PYX_INC_MEMVIEW(&__pyx_t_6, 0);
21156  {
21157  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_9 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_10 * __pyx_v_elementNodesArray.strides[1]) )));
21158  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
21159  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
21160  if (__pyx_tmp_idx < 0)
21161  __pyx_tmp_idx += __pyx_tmp_shape;
21162  if ((0)) __PYX_ERR(0, 1472, __pyx_L1_error)
21163  __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride;
21164 }
21165 
21166 __pyx_t_6.shape[0] = __pyx_v_nodeArray.shape[1];
21167 __pyx_t_6.strides[0] = __pyx_v_nodeArray.strides[1];
21168  __pyx_t_6.suboffsets[0] = -1;
21169 
21170 __PYX_XDEC_MEMVIEW(&__pyx_v_nC, 1);
21171  __pyx_v_nC = __pyx_t_6;
21172  __pyx_t_6.memview = NULL;
21173  __pyx_t_6.data = NULL;
21174 
21175  /* "mprans/MeshSmoothing.pyx":1473
21176  * nB = nodeArray[elementNodesArray[eN, 1]]
21177  * nC = nodeArray[elementNodesArray[eN, 2]]
21178  * nD = nodeArray[elementNodesArray[eN, 3]] # <<<<<<<<<<<<<<
21179  * base_tri = sqrt((nB[1]-nA[1])**2+(nB[0]-nA[0])**2)
21180  * height_tri = abs((nB[1]-nA[1])*nC[0]-(nB[0]-nA[0])*nC[1]+nB[0]*nA[1]-nB[1]*nA[0])/base_tri
21181  */
21182  __pyx_t_11 = __pyx_v_eN;
21183  __pyx_t_12 = 3;
21184  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_elementNodesArray.shape[0];
21185  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_elementNodesArray.shape[1];
21186  __pyx_t_6.data = __pyx_v_nodeArray.data;
21187  __pyx_t_6.memview = __pyx_v_nodeArray.memview;
21188  __PYX_INC_MEMVIEW(&__pyx_t_6, 0);
21189  {
21190  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_11 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_12 * __pyx_v_elementNodesArray.strides[1]) )));
21191  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
21192  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
21193  if (__pyx_tmp_idx < 0)
21194  __pyx_tmp_idx += __pyx_tmp_shape;
21195  if ((0)) __PYX_ERR(0, 1473, __pyx_L1_error)
21196  __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride;
21197 }
21198 
21199 __pyx_t_6.shape[0] = __pyx_v_nodeArray.shape[1];
21200 __pyx_t_6.strides[0] = __pyx_v_nodeArray.strides[1];
21201  __pyx_t_6.suboffsets[0] = -1;
21202 
21203 __PYX_XDEC_MEMVIEW(&__pyx_v_nD, 1);
21204  __pyx_v_nD = __pyx_t_6;
21205  __pyx_t_6.memview = NULL;
21206  __pyx_t_6.data = NULL;
21207 
21208  /* "mprans/MeshSmoothing.pyx":1474
21209  * nC = nodeArray[elementNodesArray[eN, 2]]
21210  * nD = nodeArray[elementNodesArray[eN, 3]]
21211  * base_tri = sqrt((nB[1]-nA[1])**2+(nB[0]-nA[0])**2) # <<<<<<<<<<<<<<
21212  * height_tri = abs((nB[1]-nA[1])*nC[0]-(nB[0]-nA[0])*nC[1]+nB[0]*nA[1]-nB[1]*nA[0])/base_tri
21213  * area_tri = 0.5*base_tri*height_tri
21214  */
21215  __pyx_t_13 = 1;
21216  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_nB.shape[0];
21217  __pyx_t_14 = 1;
21218  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_nA.shape[0];
21219  __pyx_t_15 = 0;
21220  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_nB.shape[0];
21221  __pyx_t_16 = 0;
21222  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nA.shape[0];
21223  __pyx_v_base_tri = sqrt((pow(((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_13 * __pyx_v_nB.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_14 * __pyx_v_nA.strides[0]) )))), 2.0) + pow(((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_15 * __pyx_v_nB.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_16 * __pyx_v_nA.strides[0]) )))), 2.0)));
21224 
21225  /* "mprans/MeshSmoothing.pyx":1475
21226  * nD = nodeArray[elementNodesArray[eN, 3]]
21227  * base_tri = sqrt((nB[1]-nA[1])**2+(nB[0]-nA[0])**2)
21228  * height_tri = abs((nB[1]-nA[1])*nC[0]-(nB[0]-nA[0])*nC[1]+nB[0]*nA[1]-nB[1]*nA[0])/base_tri # <<<<<<<<<<<<<<
21229  * area_tri = 0.5*base_tri*height_tri
21230  * height_tetra = 0.
21231  */
21232  __pyx_t_17 = 1;
21233  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_nB.shape[0];
21234  __pyx_t_18 = 1;
21235  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_nA.shape[0];
21236  __pyx_t_19 = 0;
21237  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_nC.shape[0];
21238  __pyx_t_20 = 0;
21239  if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_nB.shape[0];
21240  __pyx_t_21 = 0;
21241  if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_nA.shape[0];
21242  __pyx_t_22 = 1;
21243  if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_nC.shape[0];
21244  __pyx_t_23 = 0;
21245  if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_nB.shape[0];
21246  __pyx_t_24 = 1;
21247  if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_nA.shape[0];
21248  __pyx_t_25 = 1;
21249  if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_nB.shape[0];
21250  __pyx_t_26 = 0;
21251  if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_nA.shape[0];
21252  __pyx_v_height_tri = (fabs(((((((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_17 * __pyx_v_nB.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_18 * __pyx_v_nA.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_nC.data + __pyx_t_19 * __pyx_v_nC.strides[0]) )))) - (((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_20 * __pyx_v_nB.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_21 * __pyx_v_nA.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_nC.data + __pyx_t_22 * __pyx_v_nC.strides[0]) ))))) + ((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_23 * __pyx_v_nB.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_24 * __pyx_v_nA.strides[0]) ))))) - ((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_25 * __pyx_v_nB.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_26 * __pyx_v_nA.strides[0]) )))))) / __pyx_v_base_tri);
21253 
21254  /* "mprans/MeshSmoothing.pyx":1476
21255  * base_tri = sqrt((nB[1]-nA[1])**2+(nB[0]-nA[0])**2)
21256  * height_tri = abs((nB[1]-nA[1])*nC[0]-(nB[0]-nA[0])*nC[1]+nB[0]*nA[1]-nB[1]*nA[0])/base_tri
21257  * area_tri = 0.5*base_tri*height_tri # <<<<<<<<<<<<<<
21258  * height_tetra = 0.
21259  * elementVolumesArray_[eN] = 1./3.*area_tri*height_tetra
21260  */
21261  __pyx_v_area_tri = ((0.5 * __pyx_v_base_tri) * __pyx_v_height_tri);
21262 
21263  /* "mprans/MeshSmoothing.pyx":1477
21264  * height_tri = abs((nB[1]-nA[1])*nC[0]-(nB[0]-nA[0])*nC[1]+nB[0]*nA[1]-nB[1]*nA[0])/base_tri
21265  * area_tri = 0.5*base_tri*height_tri
21266  * height_tetra = 0. # <<<<<<<<<<<<<<
21267  * elementVolumesArray_[eN] = 1./3.*area_tri*height_tetra
21268  *
21269  */
21270  __pyx_v_height_tetra = 0.;
21271 
21272  /* "mprans/MeshSmoothing.pyx":1478
21273  * area_tri = 0.5*base_tri*height_tri
21274  * height_tetra = 0.
21275  * elementVolumesArray_[eN] = 1./3.*area_tri*height_tetra # <<<<<<<<<<<<<<
21276  *
21277  * cdef void cyUpdateElementBarycenters(double[:,:] elementBarycentersArray_,
21278  */
21279  __pyx_t_27 = __pyx_v_eN;
21280  if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_elementVolumesArray_.shape[0];
21281  *((double *) ( /* dim=0 */ (__pyx_v_elementVolumesArray_.data + __pyx_t_27 * __pyx_v_elementVolumesArray_.strides[0]) )) = (((1. / 3.) * __pyx_v_area_tri) * __pyx_v_height_tetra);
21282  }
21283 
21284  /* "mprans/MeshSmoothing.pyx":1456
21285  * return 0.5*base*height
21286  *
21287  * cdef void cyUpdateElementVolumesTetra(double[:] elementVolumesArray_, # <<<<<<<<<<<<<<
21288  * int[:,:] elementNodesArray,
21289  * double[:,:] nodeArray,
21290  */
21291 
21292  /* function exit code */
21293  goto __pyx_L0;
21294  __pyx_L1_error:;
21295  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
21296  __Pyx_WriteUnraisable("mprans.MeshSmoothing.cyUpdateElementVolumesTetra", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
21297  __pyx_L0:;
21298  __PYX_XDEC_MEMVIEW(&__pyx_v_nA, 1);
21299  __PYX_XDEC_MEMVIEW(&__pyx_v_nB, 1);
21300  __PYX_XDEC_MEMVIEW(&__pyx_v_nC, 1);
21301  __PYX_XDEC_MEMVIEW(&__pyx_v_nD, 1);
21302  __Pyx_RefNannyFinishContext();
21303 }
21304 
21305 /* "mprans/MeshSmoothing.pyx":1480
21306  * elementVolumesArray_[eN] = 1./3.*area_tri*height_tetra
21307  *
21308  * cdef void cyUpdateElementBarycenters(double[:,:] elementBarycentersArray_, # <<<<<<<<<<<<<<
21309  * int[:,:] elementNodesArray,
21310  * double[:,:] nodeArray,
21311  */
21312 
21313 static void __pyx_f_6mprans_13MeshSmoothing_cyUpdateElementBarycenters(__Pyx_memviewslice __pyx_v_elementBarycentersArray_, __Pyx_memviewslice __pyx_v_elementNodesArray, __Pyx_memviewslice __pyx_v_nodeArray, int __pyx_v_nElements) {
21314  int __pyx_v_eN;
21315  int __pyx_v_iN;
21316  int __pyx_v_node;
21317  int __pyx_v_nNel;
21318  __Pyx_RefNannyDeclarations
21319  int __pyx_t_1;
21320  int __pyx_t_2;
21321  int __pyx_t_3;
21322  Py_ssize_t __pyx_t_4;
21323  Py_ssize_t __pyx_t_5;
21324  Py_ssize_t __pyx_t_6;
21325  Py_ssize_t __pyx_t_7;
21326  Py_ssize_t __pyx_t_8;
21327  Py_ssize_t __pyx_t_9;
21328  int __pyx_t_10;
21329  int __pyx_t_11;
21330  int __pyx_t_12;
21331  Py_ssize_t __pyx_t_13;
21332  Py_ssize_t __pyx_t_14;
21333  Py_ssize_t __pyx_t_15;
21334  Py_ssize_t __pyx_t_16;
21335  Py_ssize_t __pyx_t_17;
21336  Py_ssize_t __pyx_t_18;
21337  Py_ssize_t __pyx_t_19;
21338  Py_ssize_t __pyx_t_20;
21339  Py_ssize_t __pyx_t_21;
21340  Py_ssize_t __pyx_t_22;
21341  Py_ssize_t __pyx_t_23;
21342  Py_ssize_t __pyx_t_24;
21343  Py_ssize_t __pyx_t_25;
21344  Py_ssize_t __pyx_t_26;
21345  Py_ssize_t __pyx_t_27;
21346  Py_ssize_t __pyx_t_28;
21347  Py_ssize_t __pyx_t_29;
21348  Py_ssize_t __pyx_t_30;
21349  Py_ssize_t __pyx_t_31;
21350  Py_ssize_t __pyx_t_32;
21351  Py_ssize_t __pyx_t_33;
21352  Py_ssize_t __pyx_t_34;
21353  Py_ssize_t __pyx_t_35;
21354  Py_ssize_t __pyx_t_36;
21355  Py_ssize_t __pyx_t_37;
21356  Py_ssize_t __pyx_t_38;
21357  __Pyx_RefNannySetupContext("cyUpdateElementBarycenters", 0);
21358 
21359  /* "mprans/MeshSmoothing.pyx":1487
21360  * cdef int iN
21361  * cdef int node
21362  * cdef int nNel = elementNodesArray.shape[1] # <<<<<<<<<<<<<<
21363  * for eN in range(nElements):
21364  * elementBarycentersArray_[eN, 0] = 0.
21365  */
21366  __pyx_v_nNel = (__pyx_v_elementNodesArray.shape[1]);
21367 
21368  /* "mprans/MeshSmoothing.pyx":1488
21369  * cdef int node
21370  * cdef int nNel = elementNodesArray.shape[1]
21371  * for eN in range(nElements): # <<<<<<<<<<<<<<
21372  * elementBarycentersArray_[eN, 0] = 0.
21373  * elementBarycentersArray_[eN, 1] = 0.
21374  */
21375  __pyx_t_1 = __pyx_v_nElements;
21376  __pyx_t_2 = __pyx_t_1;
21377  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
21378  __pyx_v_eN = __pyx_t_3;
21379 
21380  /* "mprans/MeshSmoothing.pyx":1489
21381  * cdef int nNel = elementNodesArray.shape[1]
21382  * for eN in range(nElements):
21383  * elementBarycentersArray_[eN, 0] = 0. # <<<<<<<<<<<<<<
21384  * elementBarycentersArray_[eN, 1] = 0.
21385  * elementBarycentersArray_[eN, 2] = 0.
21386  */
21387  __pyx_t_4 = __pyx_v_eN;
21388  __pyx_t_5 = 0;
21389  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_elementBarycentersArray_.shape[0];
21390  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBarycentersArray_.shape[1];
21391  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray_.data + __pyx_t_4 * __pyx_v_elementBarycentersArray_.strides[0]) ) + __pyx_t_5 * __pyx_v_elementBarycentersArray_.strides[1]) )) = 0.;
21392 
21393  /* "mprans/MeshSmoothing.pyx":1490
21394  * for eN in range(nElements):
21395  * elementBarycentersArray_[eN, 0] = 0.
21396  * elementBarycentersArray_[eN, 1] = 0. # <<<<<<<<<<<<<<
21397  * elementBarycentersArray_[eN, 2] = 0.
21398  * for iN in range(nNel):
21399  */
21400  __pyx_t_6 = __pyx_v_eN;
21401  __pyx_t_7 = 1;
21402  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_elementBarycentersArray_.shape[0];
21403  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_elementBarycentersArray_.shape[1];
21404  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray_.data + __pyx_t_6 * __pyx_v_elementBarycentersArray_.strides[0]) ) + __pyx_t_7 * __pyx_v_elementBarycentersArray_.strides[1]) )) = 0.;
21405 
21406  /* "mprans/MeshSmoothing.pyx":1491
21407  * elementBarycentersArray_[eN, 0] = 0.
21408  * elementBarycentersArray_[eN, 1] = 0.
21409  * elementBarycentersArray_[eN, 2] = 0. # <<<<<<<<<<<<<<
21410  * for iN in range(nNel):
21411  * node = elementNodesArray[eN, iN]
21412  */
21413  __pyx_t_8 = __pyx_v_eN;
21414  __pyx_t_9 = 2;
21415  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_elementBarycentersArray_.shape[0];
21416  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_elementBarycentersArray_.shape[1];
21417  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray_.data + __pyx_t_8 * __pyx_v_elementBarycentersArray_.strides[0]) ) + __pyx_t_9 * __pyx_v_elementBarycentersArray_.strides[1]) )) = 0.;
21418 
21419  /* "mprans/MeshSmoothing.pyx":1492
21420  * elementBarycentersArray_[eN, 1] = 0.
21421  * elementBarycentersArray_[eN, 2] = 0.
21422  * for iN in range(nNel): # <<<<<<<<<<<<<<
21423  * node = elementNodesArray[eN, iN]
21424  * elementBarycentersArray_[eN, 0] += nodeArray[node, 0]
21425  */
21426  __pyx_t_10 = __pyx_v_nNel;
21427  __pyx_t_11 = __pyx_t_10;
21428  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
21429  __pyx_v_iN = __pyx_t_12;
21430 
21431  /* "mprans/MeshSmoothing.pyx":1493
21432  * elementBarycentersArray_[eN, 2] = 0.
21433  * for iN in range(nNel):
21434  * node = elementNodesArray[eN, iN] # <<<<<<<<<<<<<<
21435  * elementBarycentersArray_[eN, 0] += nodeArray[node, 0]
21436  * elementBarycentersArray_[eN, 1] += nodeArray[node, 1]
21437  */
21438  __pyx_t_13 = __pyx_v_eN;
21439  __pyx_t_14 = __pyx_v_iN;
21440  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_elementNodesArray.shape[0];
21441  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_elementNodesArray.shape[1];
21442  __pyx_v_node = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_13 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_14 * __pyx_v_elementNodesArray.strides[1]) )));
21443 
21444  /* "mprans/MeshSmoothing.pyx":1494
21445  * for iN in range(nNel):
21446  * node = elementNodesArray[eN, iN]
21447  * elementBarycentersArray_[eN, 0] += nodeArray[node, 0] # <<<<<<<<<<<<<<
21448  * elementBarycentersArray_[eN, 1] += nodeArray[node, 1]
21449  * elementBarycentersArray_[eN, 2] += nodeArray[node, 2]
21450  */
21451  __pyx_t_15 = __pyx_v_node;
21452  __pyx_t_16 = 0;
21453  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_nodeArray.shape[0];
21454  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nodeArray.shape[1];
21455  __pyx_t_17 = __pyx_v_eN;
21456  __pyx_t_18 = 0;
21457  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_elementBarycentersArray_.shape[0];
21458  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_elementBarycentersArray_.shape[1];
21459  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray_.data + __pyx_t_17 * __pyx_v_elementBarycentersArray_.strides[0]) ) + __pyx_t_18 * __pyx_v_elementBarycentersArray_.strides[1]) )) += (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_15 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_16 * __pyx_v_nodeArray.strides[1]) )));
21460 
21461  /* "mprans/MeshSmoothing.pyx":1495
21462  * node = elementNodesArray[eN, iN]
21463  * elementBarycentersArray_[eN, 0] += nodeArray[node, 0]
21464  * elementBarycentersArray_[eN, 1] += nodeArray[node, 1] # <<<<<<<<<<<<<<
21465  * elementBarycentersArray_[eN, 2] += nodeArray[node, 2]
21466  * elementBarycentersArray_[eN, 0] = elementBarycentersArray_[eN, 0]/(iN+1)
21467  */
21468  __pyx_t_19 = __pyx_v_node;
21469  __pyx_t_20 = 1;
21470  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_nodeArray.shape[0];
21471  if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_nodeArray.shape[1];
21472  __pyx_t_21 = __pyx_v_eN;
21473  __pyx_t_22 = 1;
21474  if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_elementBarycentersArray_.shape[0];
21475  if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_elementBarycentersArray_.shape[1];
21476  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray_.data + __pyx_t_21 * __pyx_v_elementBarycentersArray_.strides[0]) ) + __pyx_t_22 * __pyx_v_elementBarycentersArray_.strides[1]) )) += (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_19 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_20 * __pyx_v_nodeArray.strides[1]) )));
21477 
21478  /* "mprans/MeshSmoothing.pyx":1496
21479  * elementBarycentersArray_[eN, 0] += nodeArray[node, 0]
21480  * elementBarycentersArray_[eN, 1] += nodeArray[node, 1]
21481  * elementBarycentersArray_[eN, 2] += nodeArray[node, 2] # <<<<<<<<<<<<<<
21482  * elementBarycentersArray_[eN, 0] = elementBarycentersArray_[eN, 0]/(iN+1)
21483  * elementBarycentersArray_[eN, 1] = elementBarycentersArray_[eN, 1]/(iN+1)
21484  */
21485  __pyx_t_23 = __pyx_v_node;
21486  __pyx_t_24 = 2;
21487  if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_nodeArray.shape[0];
21488  if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_nodeArray.shape[1];
21489  __pyx_t_25 = __pyx_v_eN;
21490  __pyx_t_26 = 2;
21491  if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_elementBarycentersArray_.shape[0];
21492  if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_elementBarycentersArray_.shape[1];
21493  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray_.data + __pyx_t_25 * __pyx_v_elementBarycentersArray_.strides[0]) ) + __pyx_t_26 * __pyx_v_elementBarycentersArray_.strides[1]) )) += (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_23 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_24 * __pyx_v_nodeArray.strides[1]) )));
21494  }
21495 
21496  /* "mprans/MeshSmoothing.pyx":1497
21497  * elementBarycentersArray_[eN, 1] += nodeArray[node, 1]
21498  * elementBarycentersArray_[eN, 2] += nodeArray[node, 2]
21499  * elementBarycentersArray_[eN, 0] = elementBarycentersArray_[eN, 0]/(iN+1) # <<<<<<<<<<<<<<
21500  * elementBarycentersArray_[eN, 1] = elementBarycentersArray_[eN, 1]/(iN+1)
21501  * elementBarycentersArray_[eN, 2] = elementBarycentersArray_[eN, 2]/(iN+1)
21502  */
21503  __pyx_t_27 = __pyx_v_eN;
21504  __pyx_t_28 = 0;
21505  if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_elementBarycentersArray_.shape[0];
21506  if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_elementBarycentersArray_.shape[1];
21507  __pyx_t_29 = __pyx_v_eN;
21508  __pyx_t_30 = 0;
21509  if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_elementBarycentersArray_.shape[0];
21510  if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_elementBarycentersArray_.shape[1];
21511  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray_.data + __pyx_t_29 * __pyx_v_elementBarycentersArray_.strides[0]) ) + __pyx_t_30 * __pyx_v_elementBarycentersArray_.strides[1]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray_.data + __pyx_t_27 * __pyx_v_elementBarycentersArray_.strides[0]) ) + __pyx_t_28 * __pyx_v_elementBarycentersArray_.strides[1]) ))) / (__pyx_v_iN + 1));
21512 
21513  /* "mprans/MeshSmoothing.pyx":1498
21514  * elementBarycentersArray_[eN, 2] += nodeArray[node, 2]
21515  * elementBarycentersArray_[eN, 0] = elementBarycentersArray_[eN, 0]/(iN+1)
21516  * elementBarycentersArray_[eN, 1] = elementBarycentersArray_[eN, 1]/(iN+1) # <<<<<<<<<<<<<<
21517  * elementBarycentersArray_[eN, 2] = elementBarycentersArray_[eN, 2]/(iN+1)
21518  *
21519  */
21520  __pyx_t_31 = __pyx_v_eN;
21521  __pyx_t_32 = 1;
21522  if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_elementBarycentersArray_.shape[0];
21523  if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_elementBarycentersArray_.shape[1];
21524  __pyx_t_33 = __pyx_v_eN;
21525  __pyx_t_34 = 1;
21526  if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_elementBarycentersArray_.shape[0];
21527  if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_elementBarycentersArray_.shape[1];
21528  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray_.data + __pyx_t_33 * __pyx_v_elementBarycentersArray_.strides[0]) ) + __pyx_t_34 * __pyx_v_elementBarycentersArray_.strides[1]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray_.data + __pyx_t_31 * __pyx_v_elementBarycentersArray_.strides[0]) ) + __pyx_t_32 * __pyx_v_elementBarycentersArray_.strides[1]) ))) / (__pyx_v_iN + 1));
21529 
21530  /* "mprans/MeshSmoothing.pyx":1499
21531  * elementBarycentersArray_[eN, 0] = elementBarycentersArray_[eN, 0]/(iN+1)
21532  * elementBarycentersArray_[eN, 1] = elementBarycentersArray_[eN, 1]/(iN+1)
21533  * elementBarycentersArray_[eN, 2] = elementBarycentersArray_[eN, 2]/(iN+1) # <<<<<<<<<<<<<<
21534  *
21535  * cdef np.ndarray cyGetCornerNodesTriangle(double[:,:] nodeArray,
21536  */
21537  __pyx_t_35 = __pyx_v_eN;
21538  __pyx_t_36 = 2;
21539  if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_elementBarycentersArray_.shape[0];
21540  if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_elementBarycentersArray_.shape[1];
21541  __pyx_t_37 = __pyx_v_eN;
21542  __pyx_t_38 = 2;
21543  if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_elementBarycentersArray_.shape[0];
21544  if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_elementBarycentersArray_.shape[1];
21545  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray_.data + __pyx_t_37 * __pyx_v_elementBarycentersArray_.strides[0]) ) + __pyx_t_38 * __pyx_v_elementBarycentersArray_.strides[1]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray_.data + __pyx_t_35 * __pyx_v_elementBarycentersArray_.strides[0]) ) + __pyx_t_36 * __pyx_v_elementBarycentersArray_.strides[1]) ))) / (__pyx_v_iN + 1));
21546  }
21547 
21548  /* "mprans/MeshSmoothing.pyx":1480
21549  * elementVolumesArray_[eN] = 1./3.*area_tri*height_tetra
21550  *
21551  * cdef void cyUpdateElementBarycenters(double[:,:] elementBarycentersArray_, # <<<<<<<<<<<<<<
21552  * int[:,:] elementNodesArray,
21553  * double[:,:] nodeArray,
21554  */
21555 
21556  /* function exit code */
21557  __Pyx_RefNannyFinishContext();
21558 }
21559 
21560 /* "mprans/MeshSmoothing.pyx":1501
21561  * elementBarycentersArray_[eN, 2] = elementBarycentersArray_[eN, 2]/(iN+1)
21562  *
21563  * cdef np.ndarray cyGetCornerNodesTriangle(double[:,:] nodeArray, # <<<<<<<<<<<<<<
21564  * int[:] nodeStarArray,
21565  * int[:] nodeStarOffsets,
21566  */
21567 
21568 static PyArrayObject *__pyx_f_6mprans_13MeshSmoothing_cyGetCornerNodesTriangle(__Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_nodeStarArray, __Pyx_memviewslice __pyx_v_nodeStarOffsets, __Pyx_memviewslice __pyx_v_nodeMaterialTypes, int __pyx_v_nNodes) {
21569  PyArrayObject *__pyx_v_cornerNodesArray = 0;
21570  double __pyx_v_vec[3];
21571  double __pyx_v_vec2[3];
21572  double __pyx_v_vec_dist;
21573  double __pyx_v_dot;
21574  int __pyx_v_node;
21575  int __pyx_v_nOffset;
21576  PyArrayObject *__pyx_r = NULL;
21577  __Pyx_RefNannyDeclarations
21578  PyObject *__pyx_t_1 = NULL;
21579  PyObject *__pyx_t_2 = NULL;
21580  PyObject *__pyx_t_3 = NULL;
21581  PyObject *__pyx_t_4 = NULL;
21582  PyObject *__pyx_t_5 = NULL;
21583  int __pyx_t_6;
21584  int __pyx_t_7;
21585  int __pyx_t_8;
21586  Py_ssize_t __pyx_t_9;
21587  int __pyx_t_10;
21588  Py_ssize_t __pyx_t_11;
21589  int __pyx_t_12;
21590  Py_ssize_t __pyx_t_13;
21591  int __pyx_t_14;
21592  int __pyx_t_15;
21593  Py_ssize_t __pyx_t_16;
21594  Py_ssize_t __pyx_t_17;
21595  int __pyx_t_18;
21596  Py_ssize_t __pyx_t_19;
21597  Py_ssize_t __pyx_t_20;
21598  Py_ssize_t __pyx_t_21;
21599  Py_ssize_t __pyx_t_22;
21600  Py_ssize_t __pyx_t_23;
21601  Py_ssize_t __pyx_t_24;
21602  Py_ssize_t __pyx_t_25;
21603  Py_ssize_t __pyx_t_26;
21604  Py_ssize_t __pyx_t_27;
21605  Py_ssize_t __pyx_t_28;
21606  Py_ssize_t __pyx_t_29;
21607  Py_ssize_t __pyx_t_30;
21608  Py_ssize_t __pyx_t_31;
21609  Py_ssize_t __pyx_t_32;
21610  Py_ssize_t __pyx_t_33;
21611  Py_ssize_t __pyx_t_34;
21612  Py_ssize_t __pyx_t_35;
21613  Py_ssize_t __pyx_t_36;
21614  Py_ssize_t __pyx_t_37;
21615  Py_ssize_t __pyx_t_38;
21616  Py_ssize_t __pyx_t_39;
21617  Py_ssize_t __pyx_t_40;
21618  Py_ssize_t __pyx_t_41;
21619  Py_ssize_t __pyx_t_42;
21620  Py_ssize_t __pyx_t_43;
21621  Py_ssize_t __pyx_t_44;
21622  Py_ssize_t __pyx_t_45;
21623  Py_ssize_t __pyx_t_46;
21624  Py_ssize_t __pyx_t_47;
21625  Py_ssize_t __pyx_t_48;
21626  int __pyx_t_49;
21627  __Pyx_RefNannySetupContext("cyGetCornerNodesTriangle", 0);
21628 
21629  /* "mprans/MeshSmoothing.pyx":1506
21630  * int[:] nodeMaterialTypes,
21631  * int nNodes):
21632  * cdef np.ndarray cornerNodesArray = np.array([], dtype=np.int32) # <<<<<<<<<<<<<<
21633  * cdef double[3] vec
21634  * cdef double[3] vec2
21635  */
21636  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1506, __pyx_L1_error)
21637  __Pyx_GOTREF(__pyx_t_1);
21638  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1506, __pyx_L1_error)
21639  __Pyx_GOTREF(__pyx_t_2);
21640  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21641  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1506, __pyx_L1_error)
21642  __Pyx_GOTREF(__pyx_t_1);
21643  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1506, __pyx_L1_error)
21644  __Pyx_GOTREF(__pyx_t_3);
21645  __Pyx_GIVEREF(__pyx_t_1);
21646  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
21647  __pyx_t_1 = 0;
21648  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1506, __pyx_L1_error)
21649  __Pyx_GOTREF(__pyx_t_1);
21650  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1506, __pyx_L1_error)
21651  __Pyx_GOTREF(__pyx_t_4);
21652  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1506, __pyx_L1_error)
21653  __Pyx_GOTREF(__pyx_t_5);
21654  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21655  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 1506, __pyx_L1_error)
21656  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
21657  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1506, __pyx_L1_error)
21658  __Pyx_GOTREF(__pyx_t_5);
21659  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21660  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21661  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21662  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1506, __pyx_L1_error)
21663  __pyx_v_cornerNodesArray = ((PyArrayObject *)__pyx_t_5);
21664  __pyx_t_5 = 0;
21665 
21666  /* "mprans/MeshSmoothing.pyx":1513
21667  * cdef int node
21668  * cdef int nOffset
21669  * for node in range(nNodes): # <<<<<<<<<<<<<<
21670  * if nodeMaterialTypes[node] != 0:
21671  * vec[0] = 0.
21672  */
21673  __pyx_t_6 = __pyx_v_nNodes;
21674  __pyx_t_7 = __pyx_t_6;
21675  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
21676  __pyx_v_node = __pyx_t_8;
21677 
21678  /* "mprans/MeshSmoothing.pyx":1514
21679  * cdef int nOffset
21680  * for node in range(nNodes):
21681  * if nodeMaterialTypes[node] != 0: # <<<<<<<<<<<<<<
21682  * vec[0] = 0.
21683  * vec[1] = 0.
21684  */
21685  __pyx_t_9 = __pyx_v_node;
21686  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_nodeMaterialTypes.shape[0];
21687  __pyx_t_10 = (((*((int *) ( /* dim=0 */ (__pyx_v_nodeMaterialTypes.data + __pyx_t_9 * __pyx_v_nodeMaterialTypes.strides[0]) ))) != 0) != 0);
21688  if (__pyx_t_10) {
21689 
21690  /* "mprans/MeshSmoothing.pyx":1515
21691  * for node in range(nNodes):
21692  * if nodeMaterialTypes[node] != 0:
21693  * vec[0] = 0. # <<<<<<<<<<<<<<
21694  * vec[1] = 0.
21695  * vec[2] = 0.
21696  */
21697  (__pyx_v_vec[0]) = 0.;
21698 
21699  /* "mprans/MeshSmoothing.pyx":1516
21700  * if nodeMaterialTypes[node] != 0:
21701  * vec[0] = 0.
21702  * vec[1] = 0. # <<<<<<<<<<<<<<
21703  * vec[2] = 0.
21704  * for nOffset in range(nodeStarOffsets[node],
21705  */
21706  (__pyx_v_vec[1]) = 0.;
21707 
21708  /* "mprans/MeshSmoothing.pyx":1517
21709  * vec[0] = 0.
21710  * vec[1] = 0.
21711  * vec[2] = 0. # <<<<<<<<<<<<<<
21712  * for nOffset in range(nodeStarOffsets[node],
21713  * nodeStarOffsets[node+1]):
21714  */
21715  (__pyx_v_vec[2]) = 0.;
21716 
21717  /* "mprans/MeshSmoothing.pyx":1519
21718  * vec[2] = 0.
21719  * for nOffset in range(nodeStarOffsets[node],
21720  * nodeStarOffsets[node+1]): # <<<<<<<<<<<<<<
21721  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
21722  * if vec[0] == 0. and vec[1] == 0. and vec[2] == 0.:
21723  */
21724  __pyx_t_11 = (__pyx_v_node + 1);
21725  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_nodeStarOffsets.shape[0];
21726  __pyx_t_12 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarOffsets.data + __pyx_t_11 * __pyx_v_nodeStarOffsets.strides[0]) )));
21727 
21728  /* "mprans/MeshSmoothing.pyx":1518
21729  * vec[1] = 0.
21730  * vec[2] = 0.
21731  * for nOffset in range(nodeStarOffsets[node], # <<<<<<<<<<<<<<
21732  * nodeStarOffsets[node+1]):
21733  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
21734  */
21735  __pyx_t_13 = __pyx_v_node;
21736  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_nodeStarOffsets.shape[0];
21737 
21738  /* "mprans/MeshSmoothing.pyx":1519
21739  * vec[2] = 0.
21740  * for nOffset in range(nodeStarOffsets[node],
21741  * nodeStarOffsets[node+1]): # <<<<<<<<<<<<<<
21742  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
21743  * if vec[0] == 0. and vec[1] == 0. and vec[2] == 0.:
21744  */
21745  __pyx_t_14 = __pyx_t_12;
21746  for (__pyx_t_15 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarOffsets.data + __pyx_t_13 * __pyx_v_nodeStarOffsets.strides[0]) ))); __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
21747 
21748  /* "mprans/MeshSmoothing.pyx":1518
21749  * vec[1] = 0.
21750  * vec[2] = 0.
21751  * for nOffset in range(nodeStarOffsets[node], # <<<<<<<<<<<<<<
21752  * nodeStarOffsets[node+1]):
21753  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
21754  */
21755  __pyx_v_nOffset = __pyx_t_15;
21756 
21757  /* "mprans/MeshSmoothing.pyx":1520
21758  * for nOffset in range(nodeStarOffsets[node],
21759  * nodeStarOffsets[node+1]):
21760  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0: # <<<<<<<<<<<<<<
21761  * if vec[0] == 0. and vec[1] == 0. and vec[2] == 0.:
21762  * # initialize first vector
21763  */
21764  __pyx_t_16 = __pyx_v_nOffset;
21765  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nodeStarArray.shape[0];
21766  __pyx_t_17 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_16 * __pyx_v_nodeStarArray.strides[0]) )));
21767  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_nodeMaterialTypes.shape[0];
21768  __pyx_t_10 = (((*((int *) ( /* dim=0 */ (__pyx_v_nodeMaterialTypes.data + __pyx_t_17 * __pyx_v_nodeMaterialTypes.strides[0]) ))) != 0) != 0);
21769  if (__pyx_t_10) {
21770 
21771  /* "mprans/MeshSmoothing.pyx":1521
21772  * nodeStarOffsets[node+1]):
21773  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
21774  * if vec[0] == 0. and vec[1] == 0. and vec[2] == 0.: # <<<<<<<<<<<<<<
21775  * # initialize first vector
21776  * vec[0] = nodeArray[node, 0]-nodeArray[nodeStarArray[nOffset], 0]
21777  */
21778  __pyx_t_18 = (((__pyx_v_vec[0]) == 0.) != 0);
21779  if (__pyx_t_18) {
21780  } else {
21781  __pyx_t_10 = __pyx_t_18;
21782  goto __pyx_L10_bool_binop_done;
21783  }
21784  __pyx_t_18 = (((__pyx_v_vec[1]) == 0.) != 0);
21785  if (__pyx_t_18) {
21786  } else {
21787  __pyx_t_10 = __pyx_t_18;
21788  goto __pyx_L10_bool_binop_done;
21789  }
21790  __pyx_t_18 = (((__pyx_v_vec[2]) == 0.) != 0);
21791  __pyx_t_10 = __pyx_t_18;
21792  __pyx_L10_bool_binop_done:;
21793  if (__pyx_t_10) {
21794 
21795  /* "mprans/MeshSmoothing.pyx":1523
21796  * if vec[0] == 0. and vec[1] == 0. and vec[2] == 0.:
21797  * # initialize first vector
21798  * vec[0] = nodeArray[node, 0]-nodeArray[nodeStarArray[nOffset], 0] # <<<<<<<<<<<<<<
21799  * vec[1] = nodeArray[node, 1]-nodeArray[nodeStarArray[nOffset], 1]
21800  * vec[2] = nodeArray[node, 2]-nodeArray[nodeStarArray[nOffset], 2]
21801  */
21802  __pyx_t_19 = __pyx_v_node;
21803  __pyx_t_20 = 0;
21804  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_nodeArray.shape[0];
21805  if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_nodeArray.shape[1];
21806  __pyx_t_21 = __pyx_v_nOffset;
21807  if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_nodeStarArray.shape[0];
21808  __pyx_t_22 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_21 * __pyx_v_nodeStarArray.strides[0]) )));
21809  __pyx_t_23 = 0;
21810  if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_nodeArray.shape[0];
21811  if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_nodeArray.shape[1];
21812  (__pyx_v_vec[0]) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_19 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_20 * __pyx_v_nodeArray.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_22 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_23 * __pyx_v_nodeArray.strides[1]) ))));
21813 
21814  /* "mprans/MeshSmoothing.pyx":1524
21815  * # initialize first vector
21816  * vec[0] = nodeArray[node, 0]-nodeArray[nodeStarArray[nOffset], 0]
21817  * vec[1] = nodeArray[node, 1]-nodeArray[nodeStarArray[nOffset], 1] # <<<<<<<<<<<<<<
21818  * vec[2] = nodeArray[node, 2]-nodeArray[nodeStarArray[nOffset], 2]
21819  * vec_dist = sqrt(vec[0]**2+vec[1]**2+vec[2]**2)
21820  */
21821  __pyx_t_24 = __pyx_v_node;
21822  __pyx_t_25 = 1;
21823  if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_nodeArray.shape[0];
21824  if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_nodeArray.shape[1];
21825  __pyx_t_26 = __pyx_v_nOffset;
21826  if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_nodeStarArray.shape[0];
21827  __pyx_t_27 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_26 * __pyx_v_nodeStarArray.strides[0]) )));
21828  __pyx_t_28 = 1;
21829  if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_nodeArray.shape[0];
21830  if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_nodeArray.shape[1];
21831  (__pyx_v_vec[1]) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_24 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_25 * __pyx_v_nodeArray.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_27 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_28 * __pyx_v_nodeArray.strides[1]) ))));
21832 
21833  /* "mprans/MeshSmoothing.pyx":1525
21834  * vec[0] = nodeArray[node, 0]-nodeArray[nodeStarArray[nOffset], 0]
21835  * vec[1] = nodeArray[node, 1]-nodeArray[nodeStarArray[nOffset], 1]
21836  * vec[2] = nodeArray[node, 2]-nodeArray[nodeStarArray[nOffset], 2] # <<<<<<<<<<<<<<
21837  * vec_dist = sqrt(vec[0]**2+vec[1]**2+vec[2]**2)
21838  * vec[0] = vec[0]/vec_dist
21839  */
21840  __pyx_t_29 = __pyx_v_node;
21841  __pyx_t_30 = 2;
21842  if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_nodeArray.shape[0];
21843  if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_nodeArray.shape[1];
21844  __pyx_t_31 = __pyx_v_nOffset;
21845  if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_nodeStarArray.shape[0];
21846  __pyx_t_32 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_31 * __pyx_v_nodeStarArray.strides[0]) )));
21847  __pyx_t_33 = 2;
21848  if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_nodeArray.shape[0];
21849  if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_nodeArray.shape[1];
21850  (__pyx_v_vec[2]) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_29 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_30 * __pyx_v_nodeArray.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_32 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_33 * __pyx_v_nodeArray.strides[1]) ))));
21851 
21852  /* "mprans/MeshSmoothing.pyx":1526
21853  * vec[1] = nodeArray[node, 1]-nodeArray[nodeStarArray[nOffset], 1]
21854  * vec[2] = nodeArray[node, 2]-nodeArray[nodeStarArray[nOffset], 2]
21855  * vec_dist = sqrt(vec[0]**2+vec[1]**2+vec[2]**2) # <<<<<<<<<<<<<<
21856  * vec[0] = vec[0]/vec_dist
21857  * vec[1] = vec[1]/vec_dist
21858  */
21859  __pyx_v_vec_dist = sqrt(((pow((__pyx_v_vec[0]), 2.0) + pow((__pyx_v_vec[1]), 2.0)) + pow((__pyx_v_vec[2]), 2.0)));
21860 
21861  /* "mprans/MeshSmoothing.pyx":1527
21862  * vec[2] = nodeArray[node, 2]-nodeArray[nodeStarArray[nOffset], 2]
21863  * vec_dist = sqrt(vec[0]**2+vec[1]**2+vec[2]**2)
21864  * vec[0] = vec[0]/vec_dist # <<<<<<<<<<<<<<
21865  * vec[1] = vec[1]/vec_dist
21866  * vec[2] = vec[2]/vec_dist
21867  */
21868  (__pyx_v_vec[0]) = ((__pyx_v_vec[0]) / __pyx_v_vec_dist);
21869 
21870  /* "mprans/MeshSmoothing.pyx":1528
21871  * vec_dist = sqrt(vec[0]**2+vec[1]**2+vec[2]**2)
21872  * vec[0] = vec[0]/vec_dist
21873  * vec[1] = vec[1]/vec_dist # <<<<<<<<<<<<<<
21874  * vec[2] = vec[2]/vec_dist
21875  * else:
21876  */
21877  (__pyx_v_vec[1]) = ((__pyx_v_vec[1]) / __pyx_v_vec_dist);
21878 
21879  /* "mprans/MeshSmoothing.pyx":1529
21880  * vec[0] = vec[0]/vec_dist
21881  * vec[1] = vec[1]/vec_dist
21882  * vec[2] = vec[2]/vec_dist # <<<<<<<<<<<<<<
21883  * else:
21884  * vec2[0] = nodeArray[node, 0]-nodeArray[nodeStarArray[nOffset], 0]
21885  */
21886  (__pyx_v_vec[2]) = ((__pyx_v_vec[2]) / __pyx_v_vec_dist);
21887 
21888  /* "mprans/MeshSmoothing.pyx":1521
21889  * nodeStarOffsets[node+1]):
21890  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
21891  * if vec[0] == 0. and vec[1] == 0. and vec[2] == 0.: # <<<<<<<<<<<<<<
21892  * # initialize first vector
21893  * vec[0] = nodeArray[node, 0]-nodeArray[nodeStarArray[nOffset], 0]
21894  */
21895  goto __pyx_L9;
21896  }
21897 
21898  /* "mprans/MeshSmoothing.pyx":1531
21899  * vec[2] = vec[2]/vec_dist
21900  * else:
21901  * vec2[0] = nodeArray[node, 0]-nodeArray[nodeStarArray[nOffset], 0] # <<<<<<<<<<<<<<
21902  * vec2[1] = nodeArray[node, 1]-nodeArray[nodeStarArray[nOffset], 1]
21903  * vec2[2] = nodeArray[node, 2]-nodeArray[nodeStarArray[nOffset], 2]
21904  */
21905  /*else*/ {
21906  __pyx_t_34 = __pyx_v_node;
21907  __pyx_t_35 = 0;
21908  if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_nodeArray.shape[0];
21909  if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_nodeArray.shape[1];
21910  __pyx_t_36 = __pyx_v_nOffset;
21911  if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_nodeStarArray.shape[0];
21912  __pyx_t_37 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_36 * __pyx_v_nodeStarArray.strides[0]) )));
21913  __pyx_t_38 = 0;
21914  if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_nodeArray.shape[0];
21915  if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_nodeArray.shape[1];
21916  (__pyx_v_vec2[0]) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_34 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_35 * __pyx_v_nodeArray.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_37 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_38 * __pyx_v_nodeArray.strides[1]) ))));
21917 
21918  /* "mprans/MeshSmoothing.pyx":1532
21919  * else:
21920  * vec2[0] = nodeArray[node, 0]-nodeArray[nodeStarArray[nOffset], 0]
21921  * vec2[1] = nodeArray[node, 1]-nodeArray[nodeStarArray[nOffset], 1] # <<<<<<<<<<<<<<
21922  * vec2[2] = nodeArray[node, 2]-nodeArray[nodeStarArray[nOffset], 2]
21923  * vec_dist = sqrt(vec2[0]**2+vec2[1]**2+vec2[2]**2)
21924  */
21925  __pyx_t_39 = __pyx_v_node;
21926  __pyx_t_40 = 1;
21927  if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_v_nodeArray.shape[0];
21928  if (__pyx_t_40 < 0) __pyx_t_40 += __pyx_v_nodeArray.shape[1];
21929  __pyx_t_41 = __pyx_v_nOffset;
21930  if (__pyx_t_41 < 0) __pyx_t_41 += __pyx_v_nodeStarArray.shape[0];
21931  __pyx_t_42 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_41 * __pyx_v_nodeStarArray.strides[0]) )));
21932  __pyx_t_43 = 1;
21933  if (__pyx_t_42 < 0) __pyx_t_42 += __pyx_v_nodeArray.shape[0];
21934  if (__pyx_t_43 < 0) __pyx_t_43 += __pyx_v_nodeArray.shape[1];
21935  (__pyx_v_vec2[1]) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_39 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_40 * __pyx_v_nodeArray.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_42 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_43 * __pyx_v_nodeArray.strides[1]) ))));
21936 
21937  /* "mprans/MeshSmoothing.pyx":1533
21938  * vec2[0] = nodeArray[node, 0]-nodeArray[nodeStarArray[nOffset], 0]
21939  * vec2[1] = nodeArray[node, 1]-nodeArray[nodeStarArray[nOffset], 1]
21940  * vec2[2] = nodeArray[node, 2]-nodeArray[nodeStarArray[nOffset], 2] # <<<<<<<<<<<<<<
21941  * vec_dist = sqrt(vec2[0]**2+vec2[1]**2+vec2[2]**2)
21942  * vec2[0] = vec2[0]/vec_dist
21943  */
21944  __pyx_t_44 = __pyx_v_node;
21945  __pyx_t_45 = 2;
21946  if (__pyx_t_44 < 0) __pyx_t_44 += __pyx_v_nodeArray.shape[0];
21947  if (__pyx_t_45 < 0) __pyx_t_45 += __pyx_v_nodeArray.shape[1];
21948  __pyx_t_46 = __pyx_v_nOffset;
21949  if (__pyx_t_46 < 0) __pyx_t_46 += __pyx_v_nodeStarArray.shape[0];
21950  __pyx_t_47 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_46 * __pyx_v_nodeStarArray.strides[0]) )));
21951  __pyx_t_48 = 2;
21952  if (__pyx_t_47 < 0) __pyx_t_47 += __pyx_v_nodeArray.shape[0];
21953  if (__pyx_t_48 < 0) __pyx_t_48 += __pyx_v_nodeArray.shape[1];
21954  (__pyx_v_vec2[2]) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_44 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_45 * __pyx_v_nodeArray.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_47 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_48 * __pyx_v_nodeArray.strides[1]) ))));
21955 
21956  /* "mprans/MeshSmoothing.pyx":1534
21957  * vec2[1] = nodeArray[node, 1]-nodeArray[nodeStarArray[nOffset], 1]
21958  * vec2[2] = nodeArray[node, 2]-nodeArray[nodeStarArray[nOffset], 2]
21959  * vec_dist = sqrt(vec2[0]**2+vec2[1]**2+vec2[2]**2) # <<<<<<<<<<<<<<
21960  * vec2[0] = vec2[0]/vec_dist
21961  * vec2[1] = vec2[1]/vec_dist
21962  */
21963  __pyx_v_vec_dist = sqrt(((pow((__pyx_v_vec2[0]), 2.0) + pow((__pyx_v_vec2[1]), 2.0)) + pow((__pyx_v_vec2[2]), 2.0)));
21964 
21965  /* "mprans/MeshSmoothing.pyx":1535
21966  * vec2[2] = nodeArray[node, 2]-nodeArray[nodeStarArray[nOffset], 2]
21967  * vec_dist = sqrt(vec2[0]**2+vec2[1]**2+vec2[2]**2)
21968  * vec2[0] = vec2[0]/vec_dist # <<<<<<<<<<<<<<
21969  * vec2[1] = vec2[1]/vec_dist
21970  * vec2[2] = vec2[2]/vec_dist
21971  */
21972  (__pyx_v_vec2[0]) = ((__pyx_v_vec2[0]) / __pyx_v_vec_dist);
21973 
21974  /* "mprans/MeshSmoothing.pyx":1536
21975  * vec_dist = sqrt(vec2[0]**2+vec2[1]**2+vec2[2]**2)
21976  * vec2[0] = vec2[0]/vec_dist
21977  * vec2[1] = vec2[1]/vec_dist # <<<<<<<<<<<<<<
21978  * vec2[2] = vec2[2]/vec_dist
21979  * dot = vec[0]*vec2[0]+vec[1]*vec2[1]+vec[2]*vec2[2]
21980  */
21981  (__pyx_v_vec2[1]) = ((__pyx_v_vec2[1]) / __pyx_v_vec_dist);
21982 
21983  /* "mprans/MeshSmoothing.pyx":1537
21984  * vec2[0] = vec2[0]/vec_dist
21985  * vec2[1] = vec2[1]/vec_dist
21986  * vec2[2] = vec2[2]/vec_dist # <<<<<<<<<<<<<<
21987  * dot = vec[0]*vec2[0]+vec[1]*vec2[1]+vec[2]*vec2[2]
21988  * if dot == 1. or dot == -1.:
21989  */
21990  (__pyx_v_vec2[2]) = ((__pyx_v_vec2[2]) / __pyx_v_vec_dist);
21991 
21992  /* "mprans/MeshSmoothing.pyx":1538
21993  * vec2[1] = vec2[1]/vec_dist
21994  * vec2[2] = vec2[2]/vec_dist
21995  * dot = vec[0]*vec2[0]+vec[1]*vec2[1]+vec[2]*vec2[2] # <<<<<<<<<<<<<<
21996  * if dot == 1. or dot == -1.:
21997  * dot = 1
21998  */
21999  __pyx_v_dot = ((((__pyx_v_vec[0]) * (__pyx_v_vec2[0])) + ((__pyx_v_vec[1]) * (__pyx_v_vec2[1]))) + ((__pyx_v_vec[2]) * (__pyx_v_vec2[2])));
22000 
22001  /* "mprans/MeshSmoothing.pyx":1539
22002  * vec2[2] = vec2[2]/vec_dist
22003  * dot = vec[0]*vec2[0]+vec[1]*vec2[1]+vec[2]*vec2[2]
22004  * if dot == 1. or dot == -1.: # <<<<<<<<<<<<<<
22005  * dot = 1
22006  * else:
22007  */
22008  __pyx_t_18 = ((__pyx_v_dot == 1.) != 0);
22009  if (!__pyx_t_18) {
22010  } else {
22011  __pyx_t_10 = __pyx_t_18;
22012  goto __pyx_L14_bool_binop_done;
22013  }
22014  __pyx_t_18 = ((__pyx_v_dot == -1.) != 0);
22015  __pyx_t_10 = __pyx_t_18;
22016  __pyx_L14_bool_binop_done:;
22017  if (__pyx_t_10) {
22018 
22019  /* "mprans/MeshSmoothing.pyx":1540
22020  * dot = vec[0]*vec2[0]+vec[1]*vec2[1]+vec[2]*vec2[2]
22021  * if dot == 1. or dot == -1.:
22022  * dot = 1 # <<<<<<<<<<<<<<
22023  * else:
22024  * cornerNodesArray = np.append(cornerNodesArray, node)
22025  */
22026  __pyx_v_dot = 1.0;
22027 
22028  /* "mprans/MeshSmoothing.pyx":1539
22029  * vec2[2] = vec2[2]/vec_dist
22030  * dot = vec[0]*vec2[0]+vec[1]*vec2[1]+vec[2]*vec2[2]
22031  * if dot == 1. or dot == -1.: # <<<<<<<<<<<<<<
22032  * dot = 1
22033  * else:
22034  */
22035  goto __pyx_L13;
22036  }
22037 
22038  /* "mprans/MeshSmoothing.pyx":1542
22039  * dot = 1
22040  * else:
22041  * cornerNodesArray = np.append(cornerNodesArray, node) # <<<<<<<<<<<<<<
22042  * return cornerNodesArray
22043  *
22044  */
22045  /*else*/ {
22046  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1542, __pyx_L1_error)
22047  __Pyx_GOTREF(__pyx_t_1);
22048  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_append); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1542, __pyx_L1_error)
22049  __Pyx_GOTREF(__pyx_t_3);
22050  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22051  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_node); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1542, __pyx_L1_error)
22052  __Pyx_GOTREF(__pyx_t_1);
22053  __pyx_t_2 = NULL;
22054  __pyx_t_49 = 0;
22055  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
22056  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
22057  if (likely(__pyx_t_2)) {
22058  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
22059  __Pyx_INCREF(__pyx_t_2);
22060  __Pyx_INCREF(function);
22061  __Pyx_DECREF_SET(__pyx_t_3, function);
22062  __pyx_t_49 = 1;
22063  }
22064  }
22065  #if CYTHON_FAST_PYCALL
22066  if (PyFunction_Check(__pyx_t_3)) {
22067  PyObject *__pyx_temp[3] = {__pyx_t_2, ((PyObject *)__pyx_v_cornerNodesArray), __pyx_t_1};
22068  __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_49, 2+__pyx_t_49); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1542, __pyx_L1_error)
22069  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
22070  __Pyx_GOTREF(__pyx_t_5);
22071  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22072  } else
22073  #endif
22074  #if CYTHON_FAST_PYCCALL
22075  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
22076  PyObject *__pyx_temp[3] = {__pyx_t_2, ((PyObject *)__pyx_v_cornerNodesArray), __pyx_t_1};
22077  __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_49, 2+__pyx_t_49); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1542, __pyx_L1_error)
22078  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
22079  __Pyx_GOTREF(__pyx_t_5);
22080  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22081  } else
22082  #endif
22083  {
22084  __pyx_t_4 = PyTuple_New(2+__pyx_t_49); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1542, __pyx_L1_error)
22085  __Pyx_GOTREF(__pyx_t_4);
22086  if (__pyx_t_2) {
22087  __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
22088  }
22089  __Pyx_INCREF(((PyObject *)__pyx_v_cornerNodesArray));
22090  __Pyx_GIVEREF(((PyObject *)__pyx_v_cornerNodesArray));
22091  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_49, ((PyObject *)__pyx_v_cornerNodesArray));
22092  __Pyx_GIVEREF(__pyx_t_1);
22093  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_49, __pyx_t_1);
22094  __pyx_t_1 = 0;
22095  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1542, __pyx_L1_error)
22096  __Pyx_GOTREF(__pyx_t_5);
22097  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22098  }
22099  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22100  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1542, __pyx_L1_error)
22101  __Pyx_DECREF_SET(__pyx_v_cornerNodesArray, ((PyArrayObject *)__pyx_t_5));
22102  __pyx_t_5 = 0;
22103  }
22104  __pyx_L13:;
22105  }
22106  __pyx_L9:;
22107 
22108  /* "mprans/MeshSmoothing.pyx":1520
22109  * for nOffset in range(nodeStarOffsets[node],
22110  * nodeStarOffsets[node+1]):
22111  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0: # <<<<<<<<<<<<<<
22112  * if vec[0] == 0. and vec[1] == 0. and vec[2] == 0.:
22113  * # initialize first vector
22114  */
22115  }
22116  }
22117 
22118  /* "mprans/MeshSmoothing.pyx":1514
22119  * cdef int nOffset
22120  * for node in range(nNodes):
22121  * if nodeMaterialTypes[node] != 0: # <<<<<<<<<<<<<<
22122  * vec[0] = 0.
22123  * vec[1] = 0.
22124  */
22125  }
22126  }
22127 
22128  /* "mprans/MeshSmoothing.pyx":1543
22129  * else:
22130  * cornerNodesArray = np.append(cornerNodesArray, node)
22131  * return cornerNodesArray # <<<<<<<<<<<<<<
22132  *
22133  * cdef int[:] cyCheckOwnedVariable(int variable_nb_local,
22134  */
22135  __Pyx_XDECREF(((PyObject *)__pyx_r));
22136  __Pyx_INCREF(((PyObject *)__pyx_v_cornerNodesArray));
22137  __pyx_r = __pyx_v_cornerNodesArray;
22138  goto __pyx_L0;
22139 
22140  /* "mprans/MeshSmoothing.pyx":1501
22141  * elementBarycentersArray_[eN, 2] = elementBarycentersArray_[eN, 2]/(iN+1)
22142  *
22143  * cdef np.ndarray cyGetCornerNodesTriangle(double[:,:] nodeArray, # <<<<<<<<<<<<<<
22144  * int[:] nodeStarArray,
22145  * int[:] nodeStarOffsets,
22146  */
22147 
22148  /* function exit code */
22149  __pyx_L1_error:;
22150  __Pyx_XDECREF(__pyx_t_1);
22151  __Pyx_XDECREF(__pyx_t_2);
22152  __Pyx_XDECREF(__pyx_t_3);
22153  __Pyx_XDECREF(__pyx_t_4);
22154  __Pyx_XDECREF(__pyx_t_5);
22155  __Pyx_AddTraceback("mprans.MeshSmoothing.cyGetCornerNodesTriangle", __pyx_clineno, __pyx_lineno, __pyx_filename);
22156  __pyx_r = 0;
22157  __pyx_L0:;
22158  __Pyx_XDECREF((PyObject *)__pyx_v_cornerNodesArray);
22159  __Pyx_XGIVEREF((PyObject *)__pyx_r);
22160  __Pyx_RefNannyFinishContext();
22161  return __pyx_r;
22162 }
22163 
22164 /* "mprans/MeshSmoothing.pyx":1545
22165  * return cornerNodesArray
22166  *
22167  * cdef int[:] cyCheckOwnedVariable(int variable_nb_local, # <<<<<<<<<<<<<<
22168  * int rank,
22169  * int nVariables_owned,
22170  */
22171 
22172 static __Pyx_memviewslice __pyx_f_6mprans_13MeshSmoothing_cyCheckOwnedVariable(int __pyx_v_variable_nb_local, int __pyx_v_rank, int __pyx_v_nVariables_owned, __Pyx_memviewslice __pyx_v_variableNumbering_subdomain2global, __Pyx_memviewslice __pyx_v_variableOffsets_subdomain_owned) {
22173  int __pyx_v_nSubdomains;
22174  int __pyx_v_variable_nb_global;
22175  int __pyx_v_new_variable_nb_local;
22176  int __pyx_v_new_rank;
22177  int __pyx_v_i;
22178  int __pyx_v_result[2];
22179  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
22180  __Pyx_RefNannyDeclarations
22181  int __pyx_t_1[2];
22182  int __pyx_t_2;
22183  Py_ssize_t __pyx_t_3;
22184  Py_ssize_t __pyx_t_4;
22185  Py_ssize_t __pyx_t_5;
22186  int __pyx_t_6;
22187  long __pyx_t_7;
22188  long __pyx_t_8;
22189  int __pyx_t_9;
22190  Py_ssize_t __pyx_t_10;
22191  Py_ssize_t __pyx_t_11;
22192  struct __pyx_array_obj *__pyx_t_12 = NULL;
22193  PyObject *__pyx_t_13 = NULL;
22194  PyObject *__pyx_t_14 = NULL;
22195  __Pyx_memviewslice __pyx_t_15 = { 0, 0, { 0 }, { 0 }, { 0 } };
22196  __Pyx_RefNannySetupContext("cyCheckOwnedVariable", 0);
22197 
22198  /* "mprans/MeshSmoothing.pyx":1550
22199  * int[:] variableNumbering_subdomain2global,
22200  * int[:] variableOffsets_subdomain_owned):
22201  * cdef int nSubdomains = variableOffsets_subdomain_owned.shape[0]-1 # <<<<<<<<<<<<<<
22202  * cdef int variable_nb_global
22203  * cdef int new_variable_nb_local
22204  */
22205  __pyx_v_nSubdomains = ((__pyx_v_variableOffsets_subdomain_owned.shape[0]) - 1);
22206 
22207  /* "mprans/MeshSmoothing.pyx":1553
22208  * cdef int variable_nb_global
22209  * cdef int new_variable_nb_local
22210  * cdef int new_rank = -2 # initialised as fake rank # <<<<<<<<<<<<<<
22211  * cdef int i
22212  * cdef int[2] result = [-1000, -1000]
22213  */
22214  __pyx_v_new_rank = -2;
22215 
22216  /* "mprans/MeshSmoothing.pyx":1555
22217  * cdef int new_rank = -2 # initialised as fake rank
22218  * cdef int i
22219  * cdef int[2] result = [-1000, -1000] # <<<<<<<<<<<<<<
22220  * # cdef int[:] result = np.zeros(2, dtype=np.int32)
22221  * result[0] = variable_nb_local
22222  */
22223  __pyx_t_1[0] = -1000;
22224  __pyx_t_1[1] = -1000;
22225  memcpy(&(__pyx_v_result[0]), __pyx_t_1, sizeof(__pyx_v_result[0]) * (2));
22226 
22227  /* "mprans/MeshSmoothing.pyx":1557
22228  * cdef int[2] result = [-1000, -1000]
22229  * # cdef int[:] result = np.zeros(2, dtype=np.int32)
22230  * result[0] = variable_nb_local # <<<<<<<<<<<<<<
22231  * result[1] = new_rank
22232  * if variable_nb_local >= nVariables_owned:
22233  */
22234  (__pyx_v_result[0]) = __pyx_v_variable_nb_local;
22235 
22236  /* "mprans/MeshSmoothing.pyx":1558
22237  * # cdef int[:] result = np.zeros(2, dtype=np.int32)
22238  * result[0] = variable_nb_local
22239  * result[1] = new_rank # <<<<<<<<<<<<<<
22240  * if variable_nb_local >= nVariables_owned:
22241  * # change rank ownership
22242  */
22243  (__pyx_v_result[1]) = __pyx_v_new_rank;
22244 
22245  /* "mprans/MeshSmoothing.pyx":1559
22246  * result[0] = variable_nb_local
22247  * result[1] = new_rank
22248  * if variable_nb_local >= nVariables_owned: # <<<<<<<<<<<<<<
22249  * # change rank ownership
22250  * variable_nb_global = variableNumbering_subdomain2global[variable_nb_local]
22251  */
22252  __pyx_t_2 = ((__pyx_v_variable_nb_local >= __pyx_v_nVariables_owned) != 0);
22253  if (__pyx_t_2) {
22254 
22255  /* "mprans/MeshSmoothing.pyx":1561
22256  * if variable_nb_local >= nVariables_owned:
22257  * # change rank ownership
22258  * variable_nb_global = variableNumbering_subdomain2global[variable_nb_local] # <<<<<<<<<<<<<<
22259  * if not variableOffsets_subdomain_owned[rank] <= variable_nb_global < variableOffsets_subdomain_owned[rank+1]:
22260  * for i in range(nSubdomains+1):
22261  */
22262  __pyx_t_3 = __pyx_v_variable_nb_local;
22263  if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_variableNumbering_subdomain2global.shape[0];
22264  __pyx_v_variable_nb_global = (*((int *) ( /* dim=0 */ (__pyx_v_variableNumbering_subdomain2global.data + __pyx_t_3 * __pyx_v_variableNumbering_subdomain2global.strides[0]) )));
22265 
22266  /* "mprans/MeshSmoothing.pyx":1562
22267  * # change rank ownership
22268  * variable_nb_global = variableNumbering_subdomain2global[variable_nb_local]
22269  * if not variableOffsets_subdomain_owned[rank] <= variable_nb_global < variableOffsets_subdomain_owned[rank+1]: # <<<<<<<<<<<<<<
22270  * for i in range(nSubdomains+1):
22271  * if variableOffsets_subdomain_owned[i] > variable_nb_global:
22272  */
22273  __pyx_t_4 = __pyx_v_rank;
22274  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_variableOffsets_subdomain_owned.shape[0];
22275  __pyx_t_2 = ((*((int *) ( /* dim=0 */ (__pyx_v_variableOffsets_subdomain_owned.data + __pyx_t_4 * __pyx_v_variableOffsets_subdomain_owned.strides[0]) ))) <= __pyx_v_variable_nb_global);
22276  if (__pyx_t_2) {
22277  __pyx_t_5 = (__pyx_v_rank + 1);
22278  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_variableOffsets_subdomain_owned.shape[0];
22279  __pyx_t_2 = (__pyx_v_variable_nb_global < (*((int *) ( /* dim=0 */ (__pyx_v_variableOffsets_subdomain_owned.data + __pyx_t_5 * __pyx_v_variableOffsets_subdomain_owned.strides[0]) ))));
22280  }
22281  __pyx_t_6 = ((!(__pyx_t_2 != 0)) != 0);
22282  if (__pyx_t_6) {
22283 
22284  /* "mprans/MeshSmoothing.pyx":1563
22285  * variable_nb_global = variableNumbering_subdomain2global[variable_nb_local]
22286  * if not variableOffsets_subdomain_owned[rank] <= variable_nb_global < variableOffsets_subdomain_owned[rank+1]:
22287  * for i in range(nSubdomains+1): # <<<<<<<<<<<<<<
22288  * if variableOffsets_subdomain_owned[i] > variable_nb_global:
22289  * # changing processor
22290  */
22291  __pyx_t_7 = (__pyx_v_nSubdomains + 1);
22292  __pyx_t_8 = __pyx_t_7;
22293  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
22294  __pyx_v_i = __pyx_t_9;
22295 
22296  /* "mprans/MeshSmoothing.pyx":1564
22297  * if not variableOffsets_subdomain_owned[rank] <= variable_nb_global < variableOffsets_subdomain_owned[rank+1]:
22298  * for i in range(nSubdomains+1):
22299  * if variableOffsets_subdomain_owned[i] > variable_nb_global: # <<<<<<<<<<<<<<
22300  * # changing processor
22301  * if new_rank == -2:
22302  */
22303  __pyx_t_10 = __pyx_v_i;
22304  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_variableOffsets_subdomain_owned.shape[0];
22305  __pyx_t_6 = (((*((int *) ( /* dim=0 */ (__pyx_v_variableOffsets_subdomain_owned.data + __pyx_t_10 * __pyx_v_variableOffsets_subdomain_owned.strides[0]) ))) > __pyx_v_variable_nb_global) != 0);
22306  if (__pyx_t_6) {
22307 
22308  /* "mprans/MeshSmoothing.pyx":1566
22309  * if variableOffsets_subdomain_owned[i] > variable_nb_global:
22310  * # changing processor
22311  * if new_rank == -2: # <<<<<<<<<<<<<<
22312  * new_rank = i-1
22313  * # getting nearest variable number on new rank
22314  */
22315  __pyx_t_6 = ((__pyx_v_new_rank == -2L) != 0);
22316  if (__pyx_t_6) {
22317 
22318  /* "mprans/MeshSmoothing.pyx":1567
22319  * # changing processor
22320  * if new_rank == -2:
22321  * new_rank = i-1 # <<<<<<<<<<<<<<
22322  * # getting nearest variable number on new rank
22323  * if new_rank >= 0:
22324  */
22325  __pyx_v_new_rank = (__pyx_v_i - 1);
22326 
22327  /* "mprans/MeshSmoothing.pyx":1566
22328  * if variableOffsets_subdomain_owned[i] > variable_nb_global:
22329  * # changing processor
22330  * if new_rank == -2: # <<<<<<<<<<<<<<
22331  * new_rank = i-1
22332  * # getting nearest variable number on new rank
22333  */
22334  }
22335 
22336  /* "mprans/MeshSmoothing.pyx":1564
22337  * if not variableOffsets_subdomain_owned[rank] <= variable_nb_global < variableOffsets_subdomain_owned[rank+1]:
22338  * for i in range(nSubdomains+1):
22339  * if variableOffsets_subdomain_owned[i] > variable_nb_global: # <<<<<<<<<<<<<<
22340  * # changing processor
22341  * if new_rank == -2:
22342  */
22343  }
22344  }
22345 
22346  /* "mprans/MeshSmoothing.pyx":1562
22347  * # change rank ownership
22348  * variable_nb_global = variableNumbering_subdomain2global[variable_nb_local]
22349  * if not variableOffsets_subdomain_owned[rank] <= variable_nb_global < variableOffsets_subdomain_owned[rank+1]: # <<<<<<<<<<<<<<
22350  * for i in range(nSubdomains+1):
22351  * if variableOffsets_subdomain_owned[i] > variable_nb_global:
22352  */
22353  }
22354 
22355  /* "mprans/MeshSmoothing.pyx":1559
22356  * result[0] = variable_nb_local
22357  * result[1] = new_rank
22358  * if variable_nb_local >= nVariables_owned: # <<<<<<<<<<<<<<
22359  * # change rank ownership
22360  * variable_nb_global = variableNumbering_subdomain2global[variable_nb_local]
22361  */
22362  }
22363 
22364  /* "mprans/MeshSmoothing.pyx":1569
22365  * new_rank = i-1
22366  * # getting nearest variable number on new rank
22367  * if new_rank >= 0: # <<<<<<<<<<<<<<
22368  * new_variable_nb_local = variable_nb_global-variableOffsets_subdomain_owned[new_rank]
22369  * else:
22370  */
22371  __pyx_t_6 = ((__pyx_v_new_rank >= 0) != 0);
22372  if (__pyx_t_6) {
22373 
22374  /* "mprans/MeshSmoothing.pyx":1570
22375  * # getting nearest variable number on new rank
22376  * if new_rank >= 0:
22377  * new_variable_nb_local = variable_nb_global-variableOffsets_subdomain_owned[new_rank] # <<<<<<<<<<<<<<
22378  * else:
22379  * new_rank = rank
22380  */
22381  __pyx_t_11 = __pyx_v_new_rank;
22382  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_variableOffsets_subdomain_owned.shape[0];
22383  __pyx_v_new_variable_nb_local = (__pyx_v_variable_nb_global - (*((int *) ( /* dim=0 */ (__pyx_v_variableOffsets_subdomain_owned.data + __pyx_t_11 * __pyx_v_variableOffsets_subdomain_owned.strides[0]) ))));
22384 
22385  /* "mprans/MeshSmoothing.pyx":1569
22386  * new_rank = i-1
22387  * # getting nearest variable number on new rank
22388  * if new_rank >= 0: # <<<<<<<<<<<<<<
22389  * new_variable_nb_local = variable_nb_global-variableOffsets_subdomain_owned[new_rank]
22390  * else:
22391  */
22392  goto __pyx_L9;
22393  }
22394 
22395  /* "mprans/MeshSmoothing.pyx":1572
22396  * new_variable_nb_local = variable_nb_global-variableOffsets_subdomain_owned[new_rank]
22397  * else:
22398  * new_rank = rank # <<<<<<<<<<<<<<
22399  * new_variable_nb_local = variable_nb_local
22400  * result[0] = new_variable_nb_local
22401  */
22402  /*else*/ {
22403  __pyx_v_new_rank = __pyx_v_rank;
22404 
22405  /* "mprans/MeshSmoothing.pyx":1573
22406  * else:
22407  * new_rank = rank
22408  * new_variable_nb_local = variable_nb_local # <<<<<<<<<<<<<<
22409  * result[0] = new_variable_nb_local
22410  * result[1] = new_rank
22411  */
22412  __pyx_v_new_variable_nb_local = __pyx_v_variable_nb_local;
22413  }
22414  __pyx_L9:;
22415 
22416  /* "mprans/MeshSmoothing.pyx":1574
22417  * new_rank = rank
22418  * new_variable_nb_local = variable_nb_local
22419  * result[0] = new_variable_nb_local # <<<<<<<<<<<<<<
22420  * result[1] = new_rank
22421  * return result
22422  */
22423  (__pyx_v_result[0]) = __pyx_v_new_variable_nb_local;
22424 
22425  /* "mprans/MeshSmoothing.pyx":1575
22426  * new_variable_nb_local = variable_nb_local
22427  * result[0] = new_variable_nb_local
22428  * result[1] = new_rank # <<<<<<<<<<<<<<
22429  * return result
22430  *
22431  */
22432  (__pyx_v_result[1]) = __pyx_v_new_rank;
22433 
22434  /* "mprans/MeshSmoothing.pyx":1576
22435  * result[0] = new_variable_nb_local
22436  * result[1] = new_rank
22437  * return result # <<<<<<<<<<<<<<
22438  *
22439  * cdef void cyFindBoundaryDirectionTriangle(
22440  */
22441  __pyx_t_14 = __pyx_format_from_typeinfo(&__Pyx_TypeInfo_int);
22442  __pyx_t_13 = Py_BuildValue((char*) "(" __PYX_BUILD_PY_SSIZE_T ")", ((Py_ssize_t)2));
22443  if (unlikely(!__pyx_t_14 || !__pyx_t_13 || !PyBytes_AsString(__pyx_t_14))) __PYX_ERR(0, 1576, __pyx_L1_error)
22444  __Pyx_GOTREF(__pyx_t_14);
22445  __Pyx_GOTREF(__pyx_t_13);
22446  __pyx_t_12 = __pyx_array_new(__pyx_t_13, sizeof(int), PyBytes_AS_STRING(__pyx_t_14), (char *) "fortran", (char *) __pyx_v_result);
22447  if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1576, __pyx_L1_error)
22448  __Pyx_GOTREF(__pyx_t_12);
22449  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
22450  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
22451  __pyx_t_15 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(((PyObject *)__pyx_t_12), PyBUF_WRITABLE); if (unlikely(!__pyx_t_15.memview)) __PYX_ERR(0, 1576, __pyx_L1_error)
22452  __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
22453  __pyx_r = __pyx_t_15;
22454  __pyx_t_15.memview = NULL;
22455  __pyx_t_15.data = NULL;
22456  goto __pyx_L0;
22457 
22458  /* "mprans/MeshSmoothing.pyx":1545
22459  * return cornerNodesArray
22460  *
22461  * cdef int[:] cyCheckOwnedVariable(int variable_nb_local, # <<<<<<<<<<<<<<
22462  * int rank,
22463  * int nVariables_owned,
22464  */
22465 
22466  /* function exit code */
22467  __pyx_L1_error:;
22468  __Pyx_XDECREF(((PyObject *)__pyx_t_12));
22469  __Pyx_XDECREF(__pyx_t_13);
22470  __Pyx_XDECREF(__pyx_t_14);
22471  __PYX_XDEC_MEMVIEW(&__pyx_t_15, 1);
22472  __pyx_r.data = NULL;
22473  __pyx_r.memview = NULL;
22474  __Pyx_AddTraceback("mprans.MeshSmoothing.cyCheckOwnedVariable", __pyx_clineno, __pyx_lineno, __pyx_filename);
22475  goto __pyx_L2;
22476  __pyx_L0:;
22477  if (unlikely(!__pyx_r.memview)) {
22478  PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
22479  }
22480  __pyx_L2:;
22481  __Pyx_RefNannyFinishContext();
22482  return __pyx_r;
22483 }
22484 
22485 /* "mprans/MeshSmoothing.pyx":1578
22486  * return result
22487  *
22488  * cdef void cyFindBoundaryDirectionTriangle( # <<<<<<<<<<<<<<
22489  * double[:] dir_,
22490  * int node,
22491  */
22492 
22493 static void __pyx_f_6mprans_13MeshSmoothing_cyFindBoundaryDirectionTriangle(__Pyx_memviewslice __pyx_v_dir_, int __pyx_v_node, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_nodeStarOffsets, __Pyx_memviewslice __pyx_v_nodeStarArray, __Pyx_memviewslice __pyx_v_nodeMaterialTypes) {
22494  double __pyx_v_dir_dist;
22495  int __pyx_v_nOffset;
22496  __Pyx_RefNannyDeclarations
22497  Py_ssize_t __pyx_t_1;
22498  int __pyx_t_2;
22499  Py_ssize_t __pyx_t_3;
22500  int __pyx_t_4;
22501  int __pyx_t_5;
22502  Py_ssize_t __pyx_t_6;
22503  Py_ssize_t __pyx_t_7;
22504  int __pyx_t_8;
22505  Py_ssize_t __pyx_t_9;
22506  Py_ssize_t __pyx_t_10;
22507  Py_ssize_t __pyx_t_11;
22508  Py_ssize_t __pyx_t_12;
22509  Py_ssize_t __pyx_t_13;
22510  Py_ssize_t __pyx_t_14;
22511  Py_ssize_t __pyx_t_15;
22512  Py_ssize_t __pyx_t_16;
22513  Py_ssize_t __pyx_t_17;
22514  Py_ssize_t __pyx_t_18;
22515  Py_ssize_t __pyx_t_19;
22516  Py_ssize_t __pyx_t_20;
22517  Py_ssize_t __pyx_t_21;
22518  Py_ssize_t __pyx_t_22;
22519  Py_ssize_t __pyx_t_23;
22520  Py_ssize_t __pyx_t_24;
22521  Py_ssize_t __pyx_t_25;
22522  Py_ssize_t __pyx_t_26;
22523  Py_ssize_t __pyx_t_27;
22524  Py_ssize_t __pyx_t_28;
22525  Py_ssize_t __pyx_t_29;
22526  Py_ssize_t __pyx_t_30;
22527  Py_ssize_t __pyx_t_31;
22528  Py_ssize_t __pyx_t_32;
22529  Py_ssize_t __pyx_t_33;
22530  Py_ssize_t __pyx_t_34;
22531  Py_ssize_t __pyx_t_35;
22532  __Pyx_RefNannySetupContext("cyFindBoundaryDirectionTriangle", 0);
22533 
22534  /* "mprans/MeshSmoothing.pyx":1589
22535  * cdef int nOffset
22536  * for nOffset in range(nodeStarOffsets[node],
22537  * nodeStarOffsets[node+1]): # <<<<<<<<<<<<<<
22538  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
22539  * dir_[0] = nodeArray[node, 0]-nodeArray[nodeStarArray[nOffset], 0]
22540  */
22541  __pyx_t_1 = (__pyx_v_node + 1);
22542  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_nodeStarOffsets.shape[0];
22543  __pyx_t_2 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarOffsets.data + __pyx_t_1 * __pyx_v_nodeStarOffsets.strides[0]) )));
22544 
22545  /* "mprans/MeshSmoothing.pyx":1588
22546  * cdef double dir_dist
22547  * cdef int nOffset
22548  * for nOffset in range(nodeStarOffsets[node], # <<<<<<<<<<<<<<
22549  * nodeStarOffsets[node+1]):
22550  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
22551  */
22552  __pyx_t_3 = __pyx_v_node;
22553  if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_nodeStarOffsets.shape[0];
22554 
22555  /* "mprans/MeshSmoothing.pyx":1589
22556  * cdef int nOffset
22557  * for nOffset in range(nodeStarOffsets[node],
22558  * nodeStarOffsets[node+1]): # <<<<<<<<<<<<<<
22559  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
22560  * dir_[0] = nodeArray[node, 0]-nodeArray[nodeStarArray[nOffset], 0]
22561  */
22562  __pyx_t_4 = __pyx_t_2;
22563  for (__pyx_t_5 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarOffsets.data + __pyx_t_3 * __pyx_v_nodeStarOffsets.strides[0]) ))); __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
22564 
22565  /* "mprans/MeshSmoothing.pyx":1588
22566  * cdef double dir_dist
22567  * cdef int nOffset
22568  * for nOffset in range(nodeStarOffsets[node], # <<<<<<<<<<<<<<
22569  * nodeStarOffsets[node+1]):
22570  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
22571  */
22572  __pyx_v_nOffset = __pyx_t_5;
22573 
22574  /* "mprans/MeshSmoothing.pyx":1590
22575  * for nOffset in range(nodeStarOffsets[node],
22576  * nodeStarOffsets[node+1]):
22577  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0: # <<<<<<<<<<<<<<
22578  * dir_[0] = nodeArray[node, 0]-nodeArray[nodeStarArray[nOffset], 0]
22579  * dir_[1] = nodeArray[node, 1]-nodeArray[nodeStarArray[nOffset], 1]
22580  */
22581  __pyx_t_6 = __pyx_v_nOffset;
22582  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_nodeStarArray.shape[0];
22583  __pyx_t_7 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_6 * __pyx_v_nodeStarArray.strides[0]) )));
22584  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_nodeMaterialTypes.shape[0];
22585  __pyx_t_8 = (((*((int *) ( /* dim=0 */ (__pyx_v_nodeMaterialTypes.data + __pyx_t_7 * __pyx_v_nodeMaterialTypes.strides[0]) ))) != 0) != 0);
22586  if (__pyx_t_8) {
22587 
22588  /* "mprans/MeshSmoothing.pyx":1591
22589  * nodeStarOffsets[node+1]):
22590  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
22591  * dir_[0] = nodeArray[node, 0]-nodeArray[nodeStarArray[nOffset], 0] # <<<<<<<<<<<<<<
22592  * dir_[1] = nodeArray[node, 1]-nodeArray[nodeStarArray[nOffset], 1]
22593  * dir_[2] = nodeArray[node, 2]-nodeArray[nodeStarArray[nOffset], 2]
22594  */
22595  __pyx_t_9 = __pyx_v_node;
22596  __pyx_t_10 = 0;
22597  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_nodeArray.shape[0];
22598  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_nodeArray.shape[1];
22599  __pyx_t_11 = __pyx_v_nOffset;
22600  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_nodeStarArray.shape[0];
22601  __pyx_t_12 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_11 * __pyx_v_nodeStarArray.strides[0]) )));
22602  __pyx_t_13 = 0;
22603  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_nodeArray.shape[0];
22604  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_nodeArray.shape[1];
22605  __pyx_t_14 = 0;
22606  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_dir_.shape[0];
22607  *((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_14 * __pyx_v_dir_.strides[0]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_9 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_10 * __pyx_v_nodeArray.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_12 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_13 * __pyx_v_nodeArray.strides[1]) ))));
22608 
22609  /* "mprans/MeshSmoothing.pyx":1592
22610  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
22611  * dir_[0] = nodeArray[node, 0]-nodeArray[nodeStarArray[nOffset], 0]
22612  * dir_[1] = nodeArray[node, 1]-nodeArray[nodeStarArray[nOffset], 1] # <<<<<<<<<<<<<<
22613  * dir_[2] = nodeArray[node, 2]-nodeArray[nodeStarArray[nOffset], 2]
22614  * dir_dist = sqrt(dir_[0]**2+dir_[1]**2+dir_[2]**2)
22615  */
22616  __pyx_t_15 = __pyx_v_node;
22617  __pyx_t_16 = 1;
22618  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_nodeArray.shape[0];
22619  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nodeArray.shape[1];
22620  __pyx_t_17 = __pyx_v_nOffset;
22621  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_nodeStarArray.shape[0];
22622  __pyx_t_18 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_17 * __pyx_v_nodeStarArray.strides[0]) )));
22623  __pyx_t_19 = 1;
22624  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_nodeArray.shape[0];
22625  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_nodeArray.shape[1];
22626  __pyx_t_20 = 1;
22627  if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_dir_.shape[0];
22628  *((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_20 * __pyx_v_dir_.strides[0]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_15 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_16 * __pyx_v_nodeArray.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_18 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_19 * __pyx_v_nodeArray.strides[1]) ))));
22629 
22630  /* "mprans/MeshSmoothing.pyx":1593
22631  * dir_[0] = nodeArray[node, 0]-nodeArray[nodeStarArray[nOffset], 0]
22632  * dir_[1] = nodeArray[node, 1]-nodeArray[nodeStarArray[nOffset], 1]
22633  * dir_[2] = nodeArray[node, 2]-nodeArray[nodeStarArray[nOffset], 2] # <<<<<<<<<<<<<<
22634  * dir_dist = sqrt(dir_[0]**2+dir_[1]**2+dir_[2]**2)
22635  * dir_[0] = abs(dir_[0])/dir_dist
22636  */
22637  __pyx_t_21 = __pyx_v_node;
22638  __pyx_t_22 = 2;
22639  if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_nodeArray.shape[0];
22640  if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_nodeArray.shape[1];
22641  __pyx_t_23 = __pyx_v_nOffset;
22642  if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_nodeStarArray.shape[0];
22643  __pyx_t_24 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_23 * __pyx_v_nodeStarArray.strides[0]) )));
22644  __pyx_t_25 = 2;
22645  if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_nodeArray.shape[0];
22646  if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_nodeArray.shape[1];
22647  __pyx_t_26 = 2;
22648  if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_dir_.shape[0];
22649  *((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_26 * __pyx_v_dir_.strides[0]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_21 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_22 * __pyx_v_nodeArray.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_24 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_25 * __pyx_v_nodeArray.strides[1]) ))));
22650 
22651  /* "mprans/MeshSmoothing.pyx":1594
22652  * dir_[1] = nodeArray[node, 1]-nodeArray[nodeStarArray[nOffset], 1]
22653  * dir_[2] = nodeArray[node, 2]-nodeArray[nodeStarArray[nOffset], 2]
22654  * dir_dist = sqrt(dir_[0]**2+dir_[1]**2+dir_[2]**2) # <<<<<<<<<<<<<<
22655  * dir_[0] = abs(dir_[0])/dir_dist
22656  * dir_[1] = abs(dir_[1])/dir_dist
22657  */
22658  __pyx_t_27 = 0;
22659  if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_dir_.shape[0];
22660  __pyx_t_28 = 1;
22661  if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_dir_.shape[0];
22662  __pyx_t_29 = 2;
22663  if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_dir_.shape[0];
22664  __pyx_v_dir_dist = sqrt(((pow((*((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_27 * __pyx_v_dir_.strides[0]) ))), 2.0) + pow((*((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_28 * __pyx_v_dir_.strides[0]) ))), 2.0)) + pow((*((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_29 * __pyx_v_dir_.strides[0]) ))), 2.0)));
22665 
22666  /* "mprans/MeshSmoothing.pyx":1595
22667  * dir_[2] = nodeArray[node, 2]-nodeArray[nodeStarArray[nOffset], 2]
22668  * dir_dist = sqrt(dir_[0]**2+dir_[1]**2+dir_[2]**2)
22669  * dir_[0] = abs(dir_[0])/dir_dist # <<<<<<<<<<<<<<
22670  * dir_[1] = abs(dir_[1])/dir_dist
22671  * dir_[2] = abs(dir_[2])/dir_dist
22672  */
22673  __pyx_t_30 = 0;
22674  if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_dir_.shape[0];
22675  __pyx_t_31 = 0;
22676  if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_dir_.shape[0];
22677  *((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_31 * __pyx_v_dir_.strides[0]) )) = (fabs((*((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_30 * __pyx_v_dir_.strides[0]) )))) / __pyx_v_dir_dist);
22678 
22679  /* "mprans/MeshSmoothing.pyx":1596
22680  * dir_dist = sqrt(dir_[0]**2+dir_[1]**2+dir_[2]**2)
22681  * dir_[0] = abs(dir_[0])/dir_dist
22682  * dir_[1] = abs(dir_[1])/dir_dist # <<<<<<<<<<<<<<
22683  * dir_[2] = abs(dir_[2])/dir_dist
22684  *
22685  */
22686  __pyx_t_32 = 1;
22687  if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_dir_.shape[0];
22688  __pyx_t_33 = 1;
22689  if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_dir_.shape[0];
22690  *((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_33 * __pyx_v_dir_.strides[0]) )) = (fabs((*((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_32 * __pyx_v_dir_.strides[0]) )))) / __pyx_v_dir_dist);
22691 
22692  /* "mprans/MeshSmoothing.pyx":1597
22693  * dir_[0] = abs(dir_[0])/dir_dist
22694  * dir_[1] = abs(dir_[1])/dir_dist
22695  * dir_[2] = abs(dir_[2])/dir_dist # <<<<<<<<<<<<<<
22696  *
22697  * cdef void cyFindBoundaryDirectionTetra(
22698  */
22699  __pyx_t_34 = 2;
22700  if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_dir_.shape[0];
22701  __pyx_t_35 = 2;
22702  if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_dir_.shape[0];
22703  *((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_35 * __pyx_v_dir_.strides[0]) )) = (fabs((*((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_34 * __pyx_v_dir_.strides[0]) )))) / __pyx_v_dir_dist);
22704 
22705  /* "mprans/MeshSmoothing.pyx":1590
22706  * for nOffset in range(nodeStarOffsets[node],
22707  * nodeStarOffsets[node+1]):
22708  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0: # <<<<<<<<<<<<<<
22709  * dir_[0] = nodeArray[node, 0]-nodeArray[nodeStarArray[nOffset], 0]
22710  * dir_[1] = nodeArray[node, 1]-nodeArray[nodeStarArray[nOffset], 1]
22711  */
22712  }
22713  }
22714 
22715  /* "mprans/MeshSmoothing.pyx":1578
22716  * return result
22717  *
22718  * cdef void cyFindBoundaryDirectionTriangle( # <<<<<<<<<<<<<<
22719  * double[:] dir_,
22720  * int node,
22721  */
22722 
22723  /* function exit code */
22724  __Pyx_RefNannyFinishContext();
22725 }
22726 
22727 /* "mprans/MeshSmoothing.pyx":1599
22728  * dir_[2] = abs(dir_[2])/dir_dist
22729  *
22730  * cdef void cyFindBoundaryDirectionTetra( # <<<<<<<<<<<<<<
22731  * double[:] dir_,
22732  * int node,
22733  */
22734 
22735 static void __pyx_f_6mprans_13MeshSmoothing_cyFindBoundaryDirectionTetra(__Pyx_memviewslice __pyx_v_dir_, int __pyx_v_node, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_nodeStarOffsets, __Pyx_memviewslice __pyx_v_nodeStarArray, __Pyx_memviewslice __pyx_v_nodeMaterialTypes) {
22736  double __pyx_v_U[3];
22737  double __pyx_v_V[3];
22738  double __pyx_v_dir_dist;
22739  __Pyx_memviewslice __pyx_v_node0 = { 0, 0, { 0 }, { 0 }, { 0 } };
22740  __Pyx_memviewslice __pyx_v_node1 = { 0, 0, { 0 }, { 0 }, { 0 } };
22741  __Pyx_memviewslice __pyx_v_node2 = { 0, 0, { 0 }, { 0 }, { 0 } };
22742  double __pyx_v_nNode;
22743  int __pyx_v_nOffset;
22744  __Pyx_RefNannyDeclarations
22745  Py_ssize_t __pyx_t_1;
22746  int __pyx_t_2;
22747  Py_ssize_t __pyx_t_3;
22748  int __pyx_t_4;
22749  int __pyx_t_5;
22750  Py_ssize_t __pyx_t_6;
22751  Py_ssize_t __pyx_t_7;
22752  int __pyx_t_8;
22753  Py_ssize_t __pyx_t_9;
22754  __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } };
22755  Py_ssize_t __pyx_t_11;
22756  Py_ssize_t __pyx_t_12;
22757  Py_ssize_t __pyx_t_13;
22758  Py_ssize_t __pyx_t_14;
22759  Py_ssize_t __pyx_t_15;
22760  Py_ssize_t __pyx_t_16;
22761  Py_ssize_t __pyx_t_17;
22762  Py_ssize_t __pyx_t_18;
22763  Py_ssize_t __pyx_t_19;
22764  Py_ssize_t __pyx_t_20;
22765  Py_ssize_t __pyx_t_21;
22766  Py_ssize_t __pyx_t_22;
22767  Py_ssize_t __pyx_t_23;
22768  Py_ssize_t __pyx_t_24;
22769  Py_ssize_t __pyx_t_25;
22770  Py_ssize_t __pyx_t_26;
22771  Py_ssize_t __pyx_t_27;
22772  Py_ssize_t __pyx_t_28;
22773  Py_ssize_t __pyx_t_29;
22774  Py_ssize_t __pyx_t_30;
22775  Py_ssize_t __pyx_t_31;
22776  Py_ssize_t __pyx_t_32;
22777  Py_ssize_t __pyx_t_33;
22778  Py_ssize_t __pyx_t_34;
22779  Py_ssize_t __pyx_t_35;
22780  Py_ssize_t __pyx_t_36;
22781  Py_ssize_t __pyx_t_37;
22782  Py_ssize_t __pyx_t_38;
22783  Py_ssize_t __pyx_t_39;
22784  __Pyx_RefNannySetupContext("cyFindBoundaryDirectionTetra", 0);
22785 
22786  /* "mprans/MeshSmoothing.pyx":1614
22787  * cdef double[:] node1
22788  * cdef double[:] node2
22789  * cdef double nNode = 0 # <<<<<<<<<<<<<<
22790  * cdef int nOffset
22791  * # get normal
22792  */
22793  __pyx_v_nNode = 0.0;
22794 
22795  /* "mprans/MeshSmoothing.pyx":1618
22796  * # get normal
22797  * for nOffset in range(nodeStarOffsets[node],
22798  * nodeStarOffsets[node+1]): # <<<<<<<<<<<<<<
22799  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
22800  * nNode += 1
22801  */
22802  __pyx_t_1 = (__pyx_v_node + 1);
22803  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_nodeStarOffsets.shape[0];
22804  __pyx_t_2 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarOffsets.data + __pyx_t_1 * __pyx_v_nodeStarOffsets.strides[0]) )));
22805 
22806  /* "mprans/MeshSmoothing.pyx":1617
22807  * cdef int nOffset
22808  * # get normal
22809  * for nOffset in range(nodeStarOffsets[node], # <<<<<<<<<<<<<<
22810  * nodeStarOffsets[node+1]):
22811  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
22812  */
22813  __pyx_t_3 = __pyx_v_node;
22814  if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_nodeStarOffsets.shape[0];
22815 
22816  /* "mprans/MeshSmoothing.pyx":1618
22817  * # get normal
22818  * for nOffset in range(nodeStarOffsets[node],
22819  * nodeStarOffsets[node+1]): # <<<<<<<<<<<<<<
22820  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
22821  * nNode += 1
22822  */
22823  __pyx_t_4 = __pyx_t_2;
22824  for (__pyx_t_5 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarOffsets.data + __pyx_t_3 * __pyx_v_nodeStarOffsets.strides[0]) ))); __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
22825 
22826  /* "mprans/MeshSmoothing.pyx":1617
22827  * cdef int nOffset
22828  * # get normal
22829  * for nOffset in range(nodeStarOffsets[node], # <<<<<<<<<<<<<<
22830  * nodeStarOffsets[node+1]):
22831  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
22832  */
22833  __pyx_v_nOffset = __pyx_t_5;
22834 
22835  /* "mprans/MeshSmoothing.pyx":1619
22836  * for nOffset in range(nodeStarOffsets[node],
22837  * nodeStarOffsets[node+1]):
22838  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0: # <<<<<<<<<<<<<<
22839  * nNode += 1
22840  * if nNode == 1:
22841  */
22842  __pyx_t_6 = __pyx_v_nOffset;
22843  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_nodeStarArray.shape[0];
22844  __pyx_t_7 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_6 * __pyx_v_nodeStarArray.strides[0]) )));
22845  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_nodeMaterialTypes.shape[0];
22846  __pyx_t_8 = (((*((int *) ( /* dim=0 */ (__pyx_v_nodeMaterialTypes.data + __pyx_t_7 * __pyx_v_nodeMaterialTypes.strides[0]) ))) != 0) != 0);
22847  if (__pyx_t_8) {
22848 
22849  /* "mprans/MeshSmoothing.pyx":1620
22850  * nodeStarOffsets[node+1]):
22851  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
22852  * nNode += 1 # <<<<<<<<<<<<<<
22853  * if nNode == 1:
22854  * node0 = nodeArray[nodeStarArray[nOffset]]
22855  */
22856  __pyx_v_nNode = (__pyx_v_nNode + 1.0);
22857 
22858  /* "mprans/MeshSmoothing.pyx":1621
22859  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
22860  * nNode += 1
22861  * if nNode == 1: # <<<<<<<<<<<<<<
22862  * node0 = nodeArray[nodeStarArray[nOffset]]
22863  * elif nNode == 2:
22864  */
22865  __pyx_t_8 = ((__pyx_v_nNode == 1.0) != 0);
22866  if (__pyx_t_8) {
22867 
22868  /* "mprans/MeshSmoothing.pyx":1622
22869  * nNode += 1
22870  * if nNode == 1:
22871  * node0 = nodeArray[nodeStarArray[nOffset]] # <<<<<<<<<<<<<<
22872  * elif nNode == 2:
22873  * node1 = nodeArray[nodeStarArray[nOffset]]
22874  */
22875  __pyx_t_9 = __pyx_v_nOffset;
22876  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_nodeStarArray.shape[0];
22877  __pyx_t_10.data = __pyx_v_nodeArray.data;
22878  __pyx_t_10.memview = __pyx_v_nodeArray.memview;
22879  __PYX_INC_MEMVIEW(&__pyx_t_10, 0);
22880  {
22881  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_9 * __pyx_v_nodeStarArray.strides[0]) )));
22882  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
22883  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
22884  if (__pyx_tmp_idx < 0)
22885  __pyx_tmp_idx += __pyx_tmp_shape;
22886  if ((0)) __PYX_ERR(0, 1622, __pyx_L1_error)
22887  __pyx_t_10.data += __pyx_tmp_idx * __pyx_tmp_stride;
22888 }
22889 
22890 __pyx_t_10.shape[0] = __pyx_v_nodeArray.shape[1];
22891 __pyx_t_10.strides[0] = __pyx_v_nodeArray.strides[1];
22892  __pyx_t_10.suboffsets[0] = -1;
22893 
22894 __PYX_XDEC_MEMVIEW(&__pyx_v_node0, 1);
22895  __pyx_v_node0 = __pyx_t_10;
22896  __pyx_t_10.memview = NULL;
22897  __pyx_t_10.data = NULL;
22898 
22899  /* "mprans/MeshSmoothing.pyx":1621
22900  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
22901  * nNode += 1
22902  * if nNode == 1: # <<<<<<<<<<<<<<
22903  * node0 = nodeArray[nodeStarArray[nOffset]]
22904  * elif nNode == 2:
22905  */
22906  goto __pyx_L6;
22907  }
22908 
22909  /* "mprans/MeshSmoothing.pyx":1623
22910  * if nNode == 1:
22911  * node0 = nodeArray[nodeStarArray[nOffset]]
22912  * elif nNode == 2: # <<<<<<<<<<<<<<
22913  * node1 = nodeArray[nodeStarArray[nOffset]]
22914  * elif nNode == 3:
22915  */
22916  __pyx_t_8 = ((__pyx_v_nNode == 2.0) != 0);
22917  if (__pyx_t_8) {
22918 
22919  /* "mprans/MeshSmoothing.pyx":1624
22920  * node0 = nodeArray[nodeStarArray[nOffset]]
22921  * elif nNode == 2:
22922  * node1 = nodeArray[nodeStarArray[nOffset]] # <<<<<<<<<<<<<<
22923  * elif nNode == 3:
22924  * node2 = nodeArray[nodeStarArray[nOffset]]
22925  */
22926  __pyx_t_11 = __pyx_v_nOffset;
22927  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_nodeStarArray.shape[0];
22928  __pyx_t_10.data = __pyx_v_nodeArray.data;
22929  __pyx_t_10.memview = __pyx_v_nodeArray.memview;
22930  __PYX_INC_MEMVIEW(&__pyx_t_10, 0);
22931  {
22932  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_11 * __pyx_v_nodeStarArray.strides[0]) )));
22933  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
22934  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
22935  if (__pyx_tmp_idx < 0)
22936  __pyx_tmp_idx += __pyx_tmp_shape;
22937  if ((0)) __PYX_ERR(0, 1624, __pyx_L1_error)
22938  __pyx_t_10.data += __pyx_tmp_idx * __pyx_tmp_stride;
22939 }
22940 
22941 __pyx_t_10.shape[0] = __pyx_v_nodeArray.shape[1];
22942 __pyx_t_10.strides[0] = __pyx_v_nodeArray.strides[1];
22943  __pyx_t_10.suboffsets[0] = -1;
22944 
22945 __PYX_XDEC_MEMVIEW(&__pyx_v_node1, 1);
22946  __pyx_v_node1 = __pyx_t_10;
22947  __pyx_t_10.memview = NULL;
22948  __pyx_t_10.data = NULL;
22949 
22950  /* "mprans/MeshSmoothing.pyx":1623
22951  * if nNode == 1:
22952  * node0 = nodeArray[nodeStarArray[nOffset]]
22953  * elif nNode == 2: # <<<<<<<<<<<<<<
22954  * node1 = nodeArray[nodeStarArray[nOffset]]
22955  * elif nNode == 3:
22956  */
22957  goto __pyx_L6;
22958  }
22959 
22960  /* "mprans/MeshSmoothing.pyx":1625
22961  * elif nNode == 2:
22962  * node1 = nodeArray[nodeStarArray[nOffset]]
22963  * elif nNode == 3: # <<<<<<<<<<<<<<
22964  * node2 = nodeArray[nodeStarArray[nOffset]]
22965  * assert nNode > 3, 'error looking for dir_'
22966  */
22967  __pyx_t_8 = ((__pyx_v_nNode == 3.0) != 0);
22968  if (__pyx_t_8) {
22969 
22970  /* "mprans/MeshSmoothing.pyx":1626
22971  * node1 = nodeArray[nodeStarArray[nOffset]]
22972  * elif nNode == 3:
22973  * node2 = nodeArray[nodeStarArray[nOffset]] # <<<<<<<<<<<<<<
22974  * assert nNode > 3, 'error looking for dir_'
22975  * U[0] = node1[0]-node0[0]
22976  */
22977  __pyx_t_12 = __pyx_v_nOffset;
22978  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_nodeStarArray.shape[0];
22979  __pyx_t_10.data = __pyx_v_nodeArray.data;
22980  __pyx_t_10.memview = __pyx_v_nodeArray.memview;
22981  __PYX_INC_MEMVIEW(&__pyx_t_10, 0);
22982  {
22983  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_12 * __pyx_v_nodeStarArray.strides[0]) )));
22984  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
22985  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
22986  if (__pyx_tmp_idx < 0)
22987  __pyx_tmp_idx += __pyx_tmp_shape;
22988  if ((0)) __PYX_ERR(0, 1626, __pyx_L1_error)
22989  __pyx_t_10.data += __pyx_tmp_idx * __pyx_tmp_stride;
22990 }
22991 
22992 __pyx_t_10.shape[0] = __pyx_v_nodeArray.shape[1];
22993 __pyx_t_10.strides[0] = __pyx_v_nodeArray.strides[1];
22994  __pyx_t_10.suboffsets[0] = -1;
22995 
22996 __PYX_XDEC_MEMVIEW(&__pyx_v_node2, 1);
22997  __pyx_v_node2 = __pyx_t_10;
22998  __pyx_t_10.memview = NULL;
22999  __pyx_t_10.data = NULL;
23000 
23001  /* "mprans/MeshSmoothing.pyx":1625
23002  * elif nNode == 2:
23003  * node1 = nodeArray[nodeStarArray[nOffset]]
23004  * elif nNode == 3: # <<<<<<<<<<<<<<
23005  * node2 = nodeArray[nodeStarArray[nOffset]]
23006  * assert nNode > 3, 'error looking for dir_'
23007  */
23008  }
23009  __pyx_L6:;
23010 
23011  /* "mprans/MeshSmoothing.pyx":1619
23012  * for nOffset in range(nodeStarOffsets[node],
23013  * nodeStarOffsets[node+1]):
23014  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0: # <<<<<<<<<<<<<<
23015  * nNode += 1
23016  * if nNode == 1:
23017  */
23018  }
23019  }
23020 
23021  /* "mprans/MeshSmoothing.pyx":1627
23022  * elif nNode == 3:
23023  * node2 = nodeArray[nodeStarArray[nOffset]]
23024  * assert nNode > 3, 'error looking for dir_' # <<<<<<<<<<<<<<
23025  * U[0] = node1[0]-node0[0]
23026  * U[1] = node1[1]-node0[1]
23027  */
23028  #ifndef CYTHON_WITHOUT_ASSERTIONS
23029  if (unlikely(!Py_OptimizeFlag)) {
23030  if (unlikely(!((__pyx_v_nNode > 3.0) != 0))) {
23031  PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_error_looking_for_dir);
23032  __PYX_ERR(0, 1627, __pyx_L1_error)
23033  }
23034  }
23035  #endif
23036 
23037  /* "mprans/MeshSmoothing.pyx":1628
23038  * node2 = nodeArray[nodeStarArray[nOffset]]
23039  * assert nNode > 3, 'error looking for dir_'
23040  * U[0] = node1[0]-node0[0] # <<<<<<<<<<<<<<
23041  * U[1] = node1[1]-node0[1]
23042  * U[2] = node1[2]-node0[2]
23043  */
23044  __pyx_t_13 = 0;
23045  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_node1.shape[0];
23046  __pyx_t_14 = 0;
23047  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_node0.shape[0];
23048  (__pyx_v_U[0]) = ((*((double *) ( /* dim=0 */ (__pyx_v_node1.data + __pyx_t_13 * __pyx_v_node1.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_node0.data + __pyx_t_14 * __pyx_v_node0.strides[0]) ))));
23049 
23050  /* "mprans/MeshSmoothing.pyx":1629
23051  * assert nNode > 3, 'error looking for dir_'
23052  * U[0] = node1[0]-node0[0]
23053  * U[1] = node1[1]-node0[1] # <<<<<<<<<<<<<<
23054  * U[2] = node1[2]-node0[2]
23055  * V[0] = node2[0]-node0[0]
23056  */
23057  __pyx_t_15 = 1;
23058  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_node1.shape[0];
23059  __pyx_t_16 = 1;
23060  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_node0.shape[0];
23061  (__pyx_v_U[1]) = ((*((double *) ( /* dim=0 */ (__pyx_v_node1.data + __pyx_t_15 * __pyx_v_node1.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_node0.data + __pyx_t_16 * __pyx_v_node0.strides[0]) ))));
23062 
23063  /* "mprans/MeshSmoothing.pyx":1630
23064  * U[0] = node1[0]-node0[0]
23065  * U[1] = node1[1]-node0[1]
23066  * U[2] = node1[2]-node0[2] # <<<<<<<<<<<<<<
23067  * V[0] = node2[0]-node0[0]
23068  * V[1] = node2[1]-node0[1]
23069  */
23070  __pyx_t_17 = 2;
23071  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_node1.shape[0];
23072  __pyx_t_18 = 2;
23073  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_node0.shape[0];
23074  (__pyx_v_U[2]) = ((*((double *) ( /* dim=0 */ (__pyx_v_node1.data + __pyx_t_17 * __pyx_v_node1.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_node0.data + __pyx_t_18 * __pyx_v_node0.strides[0]) ))));
23075 
23076  /* "mprans/MeshSmoothing.pyx":1631
23077  * U[1] = node1[1]-node0[1]
23078  * U[2] = node1[2]-node0[2]
23079  * V[0] = node2[0]-node0[0] # <<<<<<<<<<<<<<
23080  * V[1] = node2[1]-node0[1]
23081  * V[2] = node2[2]-node0[2]
23082  */
23083  __pyx_t_19 = 0;
23084  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_node2.shape[0];
23085  __pyx_t_20 = 0;
23086  if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_node0.shape[0];
23087  (__pyx_v_V[0]) = ((*((double *) ( /* dim=0 */ (__pyx_v_node2.data + __pyx_t_19 * __pyx_v_node2.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_node0.data + __pyx_t_20 * __pyx_v_node0.strides[0]) ))));
23088 
23089  /* "mprans/MeshSmoothing.pyx":1632
23090  * U[2] = node1[2]-node0[2]
23091  * V[0] = node2[0]-node0[0]
23092  * V[1] = node2[1]-node0[1] # <<<<<<<<<<<<<<
23093  * V[2] = node2[2]-node0[2]
23094  * dir_[0] = U[1]*V[2]-U[2]*V[1]
23095  */
23096  __pyx_t_21 = 1;
23097  if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_node2.shape[0];
23098  __pyx_t_22 = 1;
23099  if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_node0.shape[0];
23100  (__pyx_v_V[1]) = ((*((double *) ( /* dim=0 */ (__pyx_v_node2.data + __pyx_t_21 * __pyx_v_node2.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_node0.data + __pyx_t_22 * __pyx_v_node0.strides[0]) ))));
23101 
23102  /* "mprans/MeshSmoothing.pyx":1633
23103  * V[0] = node2[0]-node0[0]
23104  * V[1] = node2[1]-node0[1]
23105  * V[2] = node2[2]-node0[2] # <<<<<<<<<<<<<<
23106  * dir_[0] = U[1]*V[2]-U[2]*V[1]
23107  * dir_[1] = U[2]*V[0]-U[0]*V[2]
23108  */
23109  __pyx_t_23 = 2;
23110  if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_node2.shape[0];
23111  __pyx_t_24 = 2;
23112  if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_node0.shape[0];
23113  (__pyx_v_V[2]) = ((*((double *) ( /* dim=0 */ (__pyx_v_node2.data + __pyx_t_23 * __pyx_v_node2.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_node0.data + __pyx_t_24 * __pyx_v_node0.strides[0]) ))));
23114 
23115  /* "mprans/MeshSmoothing.pyx":1634
23116  * V[1] = node2[1]-node0[1]
23117  * V[2] = node2[2]-node0[2]
23118  * dir_[0] = U[1]*V[2]-U[2]*V[1] # <<<<<<<<<<<<<<
23119  * dir_[1] = U[2]*V[0]-U[0]*V[2]
23120  * dir_[2] = U[0]*V[1]-U[1]*V[0]
23121  */
23122  __pyx_t_25 = 0;
23123  if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_dir_.shape[0];
23124  *((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_25 * __pyx_v_dir_.strides[0]) )) = (((__pyx_v_U[1]) * (__pyx_v_V[2])) - ((__pyx_v_U[2]) * (__pyx_v_V[1])));
23125 
23126  /* "mprans/MeshSmoothing.pyx":1635
23127  * V[2] = node2[2]-node0[2]
23128  * dir_[0] = U[1]*V[2]-U[2]*V[1]
23129  * dir_[1] = U[2]*V[0]-U[0]*V[2] # <<<<<<<<<<<<<<
23130  * dir_[2] = U[0]*V[1]-U[1]*V[0]
23131  * dir_dist = sqrt(dir_[0]**2+dir_[1]**2+dir_[2]**2)
23132  */
23133  __pyx_t_26 = 1;
23134  if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_dir_.shape[0];
23135  *((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_26 * __pyx_v_dir_.strides[0]) )) = (((__pyx_v_U[2]) * (__pyx_v_V[0])) - ((__pyx_v_U[0]) * (__pyx_v_V[2])));
23136 
23137  /* "mprans/MeshSmoothing.pyx":1636
23138  * dir_[0] = U[1]*V[2]-U[2]*V[1]
23139  * dir_[1] = U[2]*V[0]-U[0]*V[2]
23140  * dir_[2] = U[0]*V[1]-U[1]*V[0] # <<<<<<<<<<<<<<
23141  * dir_dist = sqrt(dir_[0]**2+dir_[1]**2+dir_[2]**2)
23142  * dir_[0] /= dir_dist
23143  */
23144  __pyx_t_27 = 2;
23145  if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_dir_.shape[0];
23146  *((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_27 * __pyx_v_dir_.strides[0]) )) = (((__pyx_v_U[0]) * (__pyx_v_V[1])) - ((__pyx_v_U[1]) * (__pyx_v_V[0])));
23147 
23148  /* "mprans/MeshSmoothing.pyx":1637
23149  * dir_[1] = U[2]*V[0]-U[0]*V[2]
23150  * dir_[2] = U[0]*V[1]-U[1]*V[0]
23151  * dir_dist = sqrt(dir_[0]**2+dir_[1]**2+dir_[2]**2) # <<<<<<<<<<<<<<
23152  * dir_[0] /= dir_dist
23153  * dir_[1] /= dir_dist
23154  */
23155  __pyx_t_28 = 0;
23156  if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_dir_.shape[0];
23157  __pyx_t_29 = 1;
23158  if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_dir_.shape[0];
23159  __pyx_t_30 = 2;
23160  if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_dir_.shape[0];
23161  __pyx_v_dir_dist = sqrt(((pow((*((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_28 * __pyx_v_dir_.strides[0]) ))), 2.0) + pow((*((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_29 * __pyx_v_dir_.strides[0]) ))), 2.0)) + pow((*((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_30 * __pyx_v_dir_.strides[0]) ))), 2.0)));
23162 
23163  /* "mprans/MeshSmoothing.pyx":1638
23164  * dir_[2] = U[0]*V[1]-U[1]*V[0]
23165  * dir_dist = sqrt(dir_[0]**2+dir_[1]**2+dir_[2]**2)
23166  * dir_[0] /= dir_dist # <<<<<<<<<<<<<<
23167  * dir_[1] /= dir_dist
23168  * dir_[2] /= dir_dist
23169  */
23170  __pyx_t_31 = 0;
23171  if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_dir_.shape[0];
23172  *((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_31 * __pyx_v_dir_.strides[0]) )) /= __pyx_v_dir_dist;
23173 
23174  /* "mprans/MeshSmoothing.pyx":1639
23175  * dir_dist = sqrt(dir_[0]**2+dir_[1]**2+dir_[2]**2)
23176  * dir_[0] /= dir_dist
23177  * dir_[1] /= dir_dist # <<<<<<<<<<<<<<
23178  * dir_[2] /= dir_dist
23179  * dir_[0] = abs(1-dir_[0])
23180  */
23181  __pyx_t_32 = 1;
23182  if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_dir_.shape[0];
23183  *((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_32 * __pyx_v_dir_.strides[0]) )) /= __pyx_v_dir_dist;
23184 
23185  /* "mprans/MeshSmoothing.pyx":1640
23186  * dir_[0] /= dir_dist
23187  * dir_[1] /= dir_dist
23188  * dir_[2] /= dir_dist # <<<<<<<<<<<<<<
23189  * dir_[0] = abs(1-dir_[0])
23190  * dir_[1] = abs(1-dir_[1])
23191  */
23192  __pyx_t_33 = 2;
23193  if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_dir_.shape[0];
23194  *((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_33 * __pyx_v_dir_.strides[0]) )) /= __pyx_v_dir_dist;
23195 
23196  /* "mprans/MeshSmoothing.pyx":1641
23197  * dir_[1] /= dir_dist
23198  * dir_[2] /= dir_dist
23199  * dir_[0] = abs(1-dir_[0]) # <<<<<<<<<<<<<<
23200  * dir_[1] = abs(1-dir_[1])
23201  * dir_[2] = abs(1-dir_[2])
23202  */
23203  __pyx_t_34 = 0;
23204  if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_dir_.shape[0];
23205  __pyx_t_35 = 0;
23206  if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_dir_.shape[0];
23207  *((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_35 * __pyx_v_dir_.strides[0]) )) = fabs((1.0 - (*((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_34 * __pyx_v_dir_.strides[0]) )))));
23208 
23209  /* "mprans/MeshSmoothing.pyx":1642
23210  * dir_[2] /= dir_dist
23211  * dir_[0] = abs(1-dir_[0])
23212  * dir_[1] = abs(1-dir_[1]) # <<<<<<<<<<<<<<
23213  * dir_[2] = abs(1-dir_[2])
23214  *
23215  */
23216  __pyx_t_36 = 1;
23217  if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_dir_.shape[0];
23218  __pyx_t_37 = 1;
23219  if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_dir_.shape[0];
23220  *((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_37 * __pyx_v_dir_.strides[0]) )) = fabs((1.0 - (*((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_36 * __pyx_v_dir_.strides[0]) )))));
23221 
23222  /* "mprans/MeshSmoothing.pyx":1643
23223  * dir_[0] = abs(1-dir_[0])
23224  * dir_[1] = abs(1-dir_[1])
23225  * dir_[2] = abs(1-dir_[2]) # <<<<<<<<<<<<<<
23226  *
23227  * cdef int[:] cyGetGlobalVariable(int variable_nb_local,
23228  */
23229  __pyx_t_38 = 2;
23230  if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_dir_.shape[0];
23231  __pyx_t_39 = 2;
23232  if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_v_dir_.shape[0];
23233  *((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_39 * __pyx_v_dir_.strides[0]) )) = fabs((1.0 - (*((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_38 * __pyx_v_dir_.strides[0]) )))));
23234 
23235  /* "mprans/MeshSmoothing.pyx":1599
23236  * dir_[2] = abs(dir_[2])/dir_dist
23237  *
23238  * cdef void cyFindBoundaryDirectionTetra( # <<<<<<<<<<<<<<
23239  * double[:] dir_,
23240  * int node,
23241  */
23242 
23243  /* function exit code */
23244  goto __pyx_L0;
23245  __pyx_L1_error:;
23246  __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
23247  __Pyx_WriteUnraisable("mprans.MeshSmoothing.cyFindBoundaryDirectionTetra", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
23248  __pyx_L0:;
23249  __PYX_XDEC_MEMVIEW(&__pyx_v_node0, 1);
23250  __PYX_XDEC_MEMVIEW(&__pyx_v_node1, 1);
23251  __PYX_XDEC_MEMVIEW(&__pyx_v_node2, 1);
23252  __Pyx_RefNannyFinishContext();
23253 }
23254 
23255 /* "mprans/MeshSmoothing.pyx":1645
23256  * dir_[2] = abs(1-dir_[2])
23257  *
23258  * cdef int[:] cyGetGlobalVariable(int variable_nb_local, # <<<<<<<<<<<<<<
23259  * int nVariables_owned,
23260  * int[:] variableNumbering_subdomain2global,
23261  */
23262 
23263 static __Pyx_memviewslice __pyx_f_6mprans_13MeshSmoothing_cyGetGlobalVariable(int __pyx_v_variable_nb_local, CYTHON_UNUSED int __pyx_v_nVariables_owned, __Pyx_memviewslice __pyx_v_variableNumbering_subdomain2global, __Pyx_memviewslice __pyx_v_variableOffsets_subdomain_owned) {
23264  int __pyx_v_nSubdomains;
23265  int __pyx_v_variable_nb_global;
23266  int __pyx_v_new_rank;
23267  int __pyx_v_i;
23268  int __pyx_v_result[2];
23269  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
23270  __Pyx_RefNannyDeclarations
23271  size_t __pyx_t_1;
23272  Py_ssize_t __pyx_t_2;
23273  long __pyx_t_3;
23274  long __pyx_t_4;
23275  int __pyx_t_5;
23276  Py_ssize_t __pyx_t_6;
23277  int __pyx_t_7;
23278  Py_ssize_t __pyx_t_8;
23279  struct __pyx_array_obj *__pyx_t_9 = NULL;
23280  PyObject *__pyx_t_10 = NULL;
23281  PyObject *__pyx_t_11 = NULL;
23282  __Pyx_memviewslice __pyx_t_12 = { 0, 0, { 0 }, { 0 }, { 0 } };
23283  __Pyx_RefNannySetupContext("cyGetGlobalVariable", 0);
23284 
23285  /* "mprans/MeshSmoothing.pyx":1649
23286  * int[:] variableNumbering_subdomain2global,
23287  * int[:] variableOffsets_subdomain_owned):
23288  * cdef int nSubdomains = len(variableOffsets_subdomain_owned)-1 # <<<<<<<<<<<<<<
23289  * cdef int variable_nb_global
23290  * cdef int new_rank = -2 # initialised as fake rank
23291  */
23292  __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_variableOffsets_subdomain_owned);
23293  __pyx_v_nSubdomains = (__pyx_t_1 - 1);
23294 
23295  /* "mprans/MeshSmoothing.pyx":1651
23296  * cdef int nSubdomains = len(variableOffsets_subdomain_owned)-1
23297  * cdef int variable_nb_global
23298  * cdef int new_rank = -2 # initialised as fake rank # <<<<<<<<<<<<<<
23299  * # change rank ownership
23300  * variable_nb_global = variableNumbering_subdomain2global[variable_nb_local]
23301  */
23302  __pyx_v_new_rank = -2;
23303 
23304  /* "mprans/MeshSmoothing.pyx":1653
23305  * cdef int new_rank = -2 # initialised as fake rank
23306  * # change rank ownership
23307  * variable_nb_global = variableNumbering_subdomain2global[variable_nb_local] # <<<<<<<<<<<<<<
23308  * cdef int i
23309  * cdef int[2] result
23310  */
23311  __pyx_t_2 = __pyx_v_variable_nb_local;
23312  if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_variableNumbering_subdomain2global.shape[0];
23313  __pyx_v_variable_nb_global = (*((int *) ( /* dim=0 */ (__pyx_v_variableNumbering_subdomain2global.data + __pyx_t_2 * __pyx_v_variableNumbering_subdomain2global.strides[0]) )));
23314 
23315  /* "mprans/MeshSmoothing.pyx":1657
23316  * cdef int[2] result
23317  * # cdef int[:] result = np.zeros(2, dtype=np.int32)
23318  * result[0] = variable_nb_global # <<<<<<<<<<<<<<
23319  * result[1] = new_rank
23320  * for i in range(nSubdomains+1):
23321  */
23322  (__pyx_v_result[0]) = __pyx_v_variable_nb_global;
23323 
23324  /* "mprans/MeshSmoothing.pyx":1658
23325  * # cdef int[:] result = np.zeros(2, dtype=np.int32)
23326  * result[0] = variable_nb_global
23327  * result[1] = new_rank # <<<<<<<<<<<<<<
23328  * for i in range(nSubdomains+1):
23329  * if variableOffsets_subdomain_owned[i] > variable_nb_global:
23330  */
23331  (__pyx_v_result[1]) = __pyx_v_new_rank;
23332 
23333  /* "mprans/MeshSmoothing.pyx":1659
23334  * result[0] = variable_nb_global
23335  * result[1] = new_rank
23336  * for i in range(nSubdomains+1): # <<<<<<<<<<<<<<
23337  * if variableOffsets_subdomain_owned[i] > variable_nb_global:
23338  * # changing processor
23339  */
23340  __pyx_t_3 = (__pyx_v_nSubdomains + 1);
23341  __pyx_t_4 = __pyx_t_3;
23342  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
23343  __pyx_v_i = __pyx_t_5;
23344 
23345  /* "mprans/MeshSmoothing.pyx":1660
23346  * result[1] = new_rank
23347  * for i in range(nSubdomains+1):
23348  * if variableOffsets_subdomain_owned[i] > variable_nb_global: # <<<<<<<<<<<<<<
23349  * # changing processor
23350  * if new_rank == -2:
23351  */
23352  __pyx_t_6 = __pyx_v_i;
23353  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_variableOffsets_subdomain_owned.shape[0];
23354  __pyx_t_7 = (((*((int *) ( /* dim=0 */ (__pyx_v_variableOffsets_subdomain_owned.data + __pyx_t_6 * __pyx_v_variableOffsets_subdomain_owned.strides[0]) ))) > __pyx_v_variable_nb_global) != 0);
23355  if (__pyx_t_7) {
23356 
23357  /* "mprans/MeshSmoothing.pyx":1662
23358  * if variableOffsets_subdomain_owned[i] > variable_nb_global:
23359  * # changing processor
23360  * if new_rank == -2: # <<<<<<<<<<<<<<
23361  * new_rank = i-1
23362  * variable_nb_global = variableNumbering_subdomain2global[variable_nb_local]
23363  */
23364  __pyx_t_7 = ((__pyx_v_new_rank == -2L) != 0);
23365  if (__pyx_t_7) {
23366 
23367  /* "mprans/MeshSmoothing.pyx":1663
23368  * # changing processor
23369  * if new_rank == -2:
23370  * new_rank = i-1 # <<<<<<<<<<<<<<
23371  * variable_nb_global = variableNumbering_subdomain2global[variable_nb_local]
23372  * result[0] = variable_nb_global
23373  */
23374  __pyx_v_new_rank = (__pyx_v_i - 1);
23375 
23376  /* "mprans/MeshSmoothing.pyx":1662
23377  * if variableOffsets_subdomain_owned[i] > variable_nb_global:
23378  * # changing processor
23379  * if new_rank == -2: # <<<<<<<<<<<<<<
23380  * new_rank = i-1
23381  * variable_nb_global = variableNumbering_subdomain2global[variable_nb_local]
23382  */
23383  }
23384 
23385  /* "mprans/MeshSmoothing.pyx":1660
23386  * result[1] = new_rank
23387  * for i in range(nSubdomains+1):
23388  * if variableOffsets_subdomain_owned[i] > variable_nb_global: # <<<<<<<<<<<<<<
23389  * # changing processor
23390  * if new_rank == -2:
23391  */
23392  }
23393  }
23394 
23395  /* "mprans/MeshSmoothing.pyx":1664
23396  * if new_rank == -2:
23397  * new_rank = i-1
23398  * variable_nb_global = variableNumbering_subdomain2global[variable_nb_local] # <<<<<<<<<<<<<<
23399  * result[0] = variable_nb_global
23400  * result[1] = new_rank
23401  */
23402  __pyx_t_8 = __pyx_v_variable_nb_local;
23403  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_variableNumbering_subdomain2global.shape[0];
23404  __pyx_v_variable_nb_global = (*((int *) ( /* dim=0 */ (__pyx_v_variableNumbering_subdomain2global.data + __pyx_t_8 * __pyx_v_variableNumbering_subdomain2global.strides[0]) )));
23405 
23406  /* "mprans/MeshSmoothing.pyx":1665
23407  * new_rank = i-1
23408  * variable_nb_global = variableNumbering_subdomain2global[variable_nb_local]
23409  * result[0] = variable_nb_global # <<<<<<<<<<<<<<
23410  * result[1] = new_rank
23411  * return result
23412  */
23413  (__pyx_v_result[0]) = __pyx_v_variable_nb_global;
23414 
23415  /* "mprans/MeshSmoothing.pyx":1666
23416  * variable_nb_global = variableNumbering_subdomain2global[variable_nb_local]
23417  * result[0] = variable_nb_global
23418  * result[1] = new_rank # <<<<<<<<<<<<<<
23419  * return result
23420  *
23421  */
23422  (__pyx_v_result[1]) = __pyx_v_new_rank;
23423 
23424  /* "mprans/MeshSmoothing.pyx":1667
23425  * result[0] = variable_nb_global
23426  * result[1] = new_rank
23427  * return result # <<<<<<<<<<<<<<
23428  *
23429  * cdef int cyGetLocalVariable(int variable_nb_global,
23430  */
23431  __pyx_t_11 = __pyx_format_from_typeinfo(&__Pyx_TypeInfo_int);
23432  __pyx_t_10 = Py_BuildValue((char*) "(" __PYX_BUILD_PY_SSIZE_T ")", ((Py_ssize_t)2));
23433  if (unlikely(!__pyx_t_11 || !__pyx_t_10 || !PyBytes_AsString(__pyx_t_11))) __PYX_ERR(0, 1667, __pyx_L1_error)
23434  __Pyx_GOTREF(__pyx_t_11);
23435  __Pyx_GOTREF(__pyx_t_10);
23436  __pyx_t_9 = __pyx_array_new(__pyx_t_10, sizeof(int), PyBytes_AS_STRING(__pyx_t_11), (char *) "fortran", (char *) __pyx_v_result);
23437  if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1667, __pyx_L1_error)
23438  __Pyx_GOTREF(__pyx_t_9);
23439  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
23440  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
23441  __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(((PyObject *)__pyx_t_9), PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(0, 1667, __pyx_L1_error)
23442  __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
23443  __pyx_r = __pyx_t_12;
23444  __pyx_t_12.memview = NULL;
23445  __pyx_t_12.data = NULL;
23446  goto __pyx_L0;
23447 
23448  /* "mprans/MeshSmoothing.pyx":1645
23449  * dir_[2] = abs(1-dir_[2])
23450  *
23451  * cdef int[:] cyGetGlobalVariable(int variable_nb_local, # <<<<<<<<<<<<<<
23452  * int nVariables_owned,
23453  * int[:] variableNumbering_subdomain2global,
23454  */
23455 
23456  /* function exit code */
23457  __pyx_L1_error:;
23458  __Pyx_XDECREF(((PyObject *)__pyx_t_9));
23459  __Pyx_XDECREF(__pyx_t_10);
23460  __Pyx_XDECREF(__pyx_t_11);
23461  __PYX_XDEC_MEMVIEW(&__pyx_t_12, 1);
23462  __pyx_r.data = NULL;
23463  __pyx_r.memview = NULL;
23464  __Pyx_AddTraceback("mprans.MeshSmoothing.cyGetGlobalVariable", __pyx_clineno, __pyx_lineno, __pyx_filename);
23465  goto __pyx_L2;
23466  __pyx_L0:;
23467  if (unlikely(!__pyx_r.memview)) {
23468  PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
23469  }
23470  __pyx_L2:;
23471  __Pyx_RefNannyFinishContext();
23472  return __pyx_r;
23473 }
23474 
23475 /* "mprans/MeshSmoothing.pyx":1669
23476  * return result
23477  *
23478  * cdef int cyGetLocalVariable(int variable_nb_global, # <<<<<<<<<<<<<<
23479  * int rank,
23480  * int nVariables_owned,
23481  */
23482 
23483 static int __pyx_f_6mprans_13MeshSmoothing_cyGetLocalVariable(int __pyx_v_variable_nb_global, int __pyx_v_rank, int __pyx_v_nVariables_owned, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_variableNumbering_subdomain2global, __Pyx_memviewslice __pyx_v_variableOffsets_subdomain_owned) {
23484  int __pyx_v_new_variable_nb_local;
23485  int __pyx_r;
23486  __Pyx_RefNannyDeclarations
23487  Py_ssize_t __pyx_t_1;
23488  int __pyx_t_2;
23489  Py_ssize_t __pyx_t_3;
23490  int __pyx_t_4;
23491  Py_ssize_t __pyx_t_5;
23492  __Pyx_RefNannySetupContext("cyGetLocalVariable", 0);
23493 
23494  /* "mprans/MeshSmoothing.pyx":1675
23495  * int[:] variableOffsets_subdomain_owned):
23496  * cdef int new_variable_nb_local
23497  * if not variableOffsets_subdomain_owned[rank] <= variable_nb_global < variableOffsets_subdomain_owned[rank+1]: # <<<<<<<<<<<<<<
23498  * if variable_nb_global < nVariables_owned:
23499  * new_variable_nb_local = variable_nb_global
23500  */
23501  __pyx_t_1 = __pyx_v_rank;
23502  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_variableOffsets_subdomain_owned.shape[0];
23503  __pyx_t_2 = ((*((int *) ( /* dim=0 */ (__pyx_v_variableOffsets_subdomain_owned.data + __pyx_t_1 * __pyx_v_variableOffsets_subdomain_owned.strides[0]) ))) <= __pyx_v_variable_nb_global);
23504  if (__pyx_t_2) {
23505  __pyx_t_3 = (__pyx_v_rank + 1);
23506  if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_variableOffsets_subdomain_owned.shape[0];
23507  __pyx_t_2 = (__pyx_v_variable_nb_global < (*((int *) ( /* dim=0 */ (__pyx_v_variableOffsets_subdomain_owned.data + __pyx_t_3 * __pyx_v_variableOffsets_subdomain_owned.strides[0]) ))));
23508  }
23509  __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
23510  if (__pyx_t_4) {
23511 
23512  /* "mprans/MeshSmoothing.pyx":1676
23513  * cdef int new_variable_nb_local
23514  * if not variableOffsets_subdomain_owned[rank] <= variable_nb_global < variableOffsets_subdomain_owned[rank+1]:
23515  * if variable_nb_global < nVariables_owned: # <<<<<<<<<<<<<<
23516  * new_variable_nb_local = variable_nb_global
23517  * else:
23518  */
23519  __pyx_t_4 = ((__pyx_v_variable_nb_global < __pyx_v_nVariables_owned) != 0);
23520  if (__pyx_t_4) {
23521 
23522  /* "mprans/MeshSmoothing.pyx":1677
23523  * if not variableOffsets_subdomain_owned[rank] <= variable_nb_global < variableOffsets_subdomain_owned[rank+1]:
23524  * if variable_nb_global < nVariables_owned:
23525  * new_variable_nb_local = variable_nb_global # <<<<<<<<<<<<<<
23526  * else:
23527  * new_variable_nb_local = variable_nb_global-variableOffsets_subdomain_owned[rank]
23528  */
23529  __pyx_v_new_variable_nb_local = __pyx_v_variable_nb_global;
23530 
23531  /* "mprans/MeshSmoothing.pyx":1676
23532  * cdef int new_variable_nb_local
23533  * if not variableOffsets_subdomain_owned[rank] <= variable_nb_global < variableOffsets_subdomain_owned[rank+1]:
23534  * if variable_nb_global < nVariables_owned: # <<<<<<<<<<<<<<
23535  * new_variable_nb_local = variable_nb_global
23536  * else:
23537  */
23538  }
23539 
23540  /* "mprans/MeshSmoothing.pyx":1675
23541  * int[:] variableOffsets_subdomain_owned):
23542  * cdef int new_variable_nb_local
23543  * if not variableOffsets_subdomain_owned[rank] <= variable_nb_global < variableOffsets_subdomain_owned[rank+1]: # <<<<<<<<<<<<<<
23544  * if variable_nb_global < nVariables_owned:
23545  * new_variable_nb_local = variable_nb_global
23546  */
23547  goto __pyx_L3;
23548  }
23549 
23550  /* "mprans/MeshSmoothing.pyx":1679
23551  * new_variable_nb_local = variable_nb_global
23552  * else:
23553  * new_variable_nb_local = variable_nb_global-variableOffsets_subdomain_owned[rank] # <<<<<<<<<<<<<<
23554  * return new_variable_nb_local
23555  *
23556  */
23557  /*else*/ {
23558  __pyx_t_5 = __pyx_v_rank;
23559  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_variableOffsets_subdomain_owned.shape[0];
23560  __pyx_v_new_variable_nb_local = (__pyx_v_variable_nb_global - (*((int *) ( /* dim=0 */ (__pyx_v_variableOffsets_subdomain_owned.data + __pyx_t_5 * __pyx_v_variableOffsets_subdomain_owned.strides[0]) ))));
23561  }
23562  __pyx_L3:;
23563 
23564  /* "mprans/MeshSmoothing.pyx":1680
23565  * else:
23566  * new_variable_nb_local = variable_nb_global-variableOffsets_subdomain_owned[rank]
23567  * return new_variable_nb_local # <<<<<<<<<<<<<<
23568  *
23569  * cdef double[:] cyScalarRecoveryAtNodes(double[:] scalars,
23570  */
23571  __pyx_r = __pyx_v_new_variable_nb_local;
23572  goto __pyx_L0;
23573 
23574  /* "mprans/MeshSmoothing.pyx":1669
23575  * return result
23576  *
23577  * cdef int cyGetLocalVariable(int variable_nb_global, # <<<<<<<<<<<<<<
23578  * int rank,
23579  * int nVariables_owned,
23580  */
23581 
23582  /* function exit code */
23583  __pyx_L0:;
23584  __Pyx_RefNannyFinishContext();
23585  return __pyx_r;
23586 }
23587 
23588 /* "mprans/MeshSmoothing.pyx":1682
23589  * return new_variable_nb_local
23590  *
23591  * cdef double[:] cyScalarRecoveryAtNodes(double[:] scalars, # <<<<<<<<<<<<<<
23592  * int[:] nodeElementsArray,
23593  * int[:] nodeElementOffsets):
23594  */
23595 
23596 static __Pyx_memviewslice __pyx_f_6mprans_13MeshSmoothing_cyScalarRecoveryAtNodes(__Pyx_memviewslice __pyx_v_scalars, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets) {
23597  __Pyx_memviewslice __pyx_v_recovered_scalars = { 0, 0, { 0 }, { 0 }, { 0 } };
23598  int __pyx_v_nb_el;
23599  double __pyx_v_var_sum;
23600  int __pyx_v_node;
23601  int __pyx_v_eOffset;
23602  int __pyx_v_nNodes;
23603  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
23604  __Pyx_RefNannyDeclarations
23605  PyObject *__pyx_t_1 = NULL;
23606  PyObject *__pyx_t_2 = NULL;
23607  PyObject *__pyx_t_3 = NULL;
23608  size_t __pyx_t_4;
23609  PyObject *__pyx_t_5 = NULL;
23610  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
23611  int __pyx_t_7;
23612  int __pyx_t_8;
23613  int __pyx_t_9;
23614  Py_ssize_t __pyx_t_10;
23615  int __pyx_t_11;
23616  Py_ssize_t __pyx_t_12;
23617  int __pyx_t_13;
23618  int __pyx_t_14;
23619  Py_ssize_t __pyx_t_15;
23620  Py_ssize_t __pyx_t_16;
23621  Py_ssize_t __pyx_t_17;
23622  __Pyx_RefNannySetupContext("cyScalarRecoveryAtNodes", 0);
23623 
23624  /* "mprans/MeshSmoothing.pyx":1685
23625  * int[:] nodeElementsArray,
23626  * int[:] nodeElementOffsets):
23627  * cdef double[:] recovered_scalars = np.zeros(len(nodeElementOffsets)-1) # <<<<<<<<<<<<<<
23628  * cdef int nb_el
23629  * cdef double var_sum
23630  */
23631  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1685, __pyx_L1_error)
23632  __Pyx_GOTREF(__pyx_t_2);
23633  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1685, __pyx_L1_error)
23634  __Pyx_GOTREF(__pyx_t_3);
23635  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
23636  __pyx_t_4 = __Pyx_MemoryView_Len(__pyx_v_nodeElementOffsets);
23637  __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_4 - 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1685, __pyx_L1_error)
23638  __Pyx_GOTREF(__pyx_t_2);
23639  __pyx_t_5 = NULL;
23640  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
23641  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
23642  if (likely(__pyx_t_5)) {
23643  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
23644  __Pyx_INCREF(__pyx_t_5);
23645  __Pyx_INCREF(function);
23646  __Pyx_DECREF_SET(__pyx_t_3, function);
23647  }
23648  }
23649  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
23650  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
23651  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
23652  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1685, __pyx_L1_error)
23653  __Pyx_GOTREF(__pyx_t_1);
23654  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23655  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1685, __pyx_L1_error)
23656  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23657  __pyx_v_recovered_scalars = __pyx_t_6;
23658  __pyx_t_6.memview = NULL;
23659  __pyx_t_6.data = NULL;
23660 
23661  /* "mprans/MeshSmoothing.pyx":1690
23662  * cdef int node
23663  * cdef int eOffset
23664  * cdef int nNodes = nodeElementOffsets.shape[0]-1 # <<<<<<<<<<<<<<
23665  * for node in range(nNodes):
23666  * nb_el = 0
23667  */
23668  __pyx_v_nNodes = ((__pyx_v_nodeElementOffsets.shape[0]) - 1);
23669 
23670  /* "mprans/MeshSmoothing.pyx":1691
23671  * cdef int eOffset
23672  * cdef int nNodes = nodeElementOffsets.shape[0]-1
23673  * for node in range(nNodes): # <<<<<<<<<<<<<<
23674  * nb_el = 0
23675  * var_sum = 0
23676  */
23677  __pyx_t_7 = __pyx_v_nNodes;
23678  __pyx_t_8 = __pyx_t_7;
23679  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
23680  __pyx_v_node = __pyx_t_9;
23681 
23682  /* "mprans/MeshSmoothing.pyx":1692
23683  * cdef int nNodes = nodeElementOffsets.shape[0]-1
23684  * for node in range(nNodes):
23685  * nb_el = 0 # <<<<<<<<<<<<<<
23686  * var_sum = 0
23687  * for eOffset in range(nodeElementOffsets[node],
23688  */
23689  __pyx_v_nb_el = 0;
23690 
23691  /* "mprans/MeshSmoothing.pyx":1693
23692  * for node in range(nNodes):
23693  * nb_el = 0
23694  * var_sum = 0 # <<<<<<<<<<<<<<
23695  * for eOffset in range(nodeElementOffsets[node],
23696  * nodeElementOffsets[node+1]):
23697  */
23698  __pyx_v_var_sum = 0.0;
23699 
23700  /* "mprans/MeshSmoothing.pyx":1695
23701  * var_sum = 0
23702  * for eOffset in range(nodeElementOffsets[node],
23703  * nodeElementOffsets[node+1]): # <<<<<<<<<<<<<<
23704  * nb_el += 1
23705  * var_sum += scalars[nodeElementsArray[eOffset]]
23706  */
23707  __pyx_t_10 = (__pyx_v_node + 1);
23708  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_nodeElementOffsets.shape[0];
23709  __pyx_t_11 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_10 * __pyx_v_nodeElementOffsets.strides[0]) )));
23710 
23711  /* "mprans/MeshSmoothing.pyx":1694
23712  * nb_el = 0
23713  * var_sum = 0
23714  * for eOffset in range(nodeElementOffsets[node], # <<<<<<<<<<<<<<
23715  * nodeElementOffsets[node+1]):
23716  * nb_el += 1
23717  */
23718  __pyx_t_12 = __pyx_v_node;
23719  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_nodeElementOffsets.shape[0];
23720 
23721  /* "mprans/MeshSmoothing.pyx":1695
23722  * var_sum = 0
23723  * for eOffset in range(nodeElementOffsets[node],
23724  * nodeElementOffsets[node+1]): # <<<<<<<<<<<<<<
23725  * nb_el += 1
23726  * var_sum += scalars[nodeElementsArray[eOffset]]
23727  */
23728  __pyx_t_13 = __pyx_t_11;
23729  for (__pyx_t_14 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_12 * __pyx_v_nodeElementOffsets.strides[0]) ))); __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
23730 
23731  /* "mprans/MeshSmoothing.pyx":1694
23732  * nb_el = 0
23733  * var_sum = 0
23734  * for eOffset in range(nodeElementOffsets[node], # <<<<<<<<<<<<<<
23735  * nodeElementOffsets[node+1]):
23736  * nb_el += 1
23737  */
23738  __pyx_v_eOffset = __pyx_t_14;
23739 
23740  /* "mprans/MeshSmoothing.pyx":1696
23741  * for eOffset in range(nodeElementOffsets[node],
23742  * nodeElementOffsets[node+1]):
23743  * nb_el += 1 # <<<<<<<<<<<<<<
23744  * var_sum += scalars[nodeElementsArray[eOffset]]
23745  * recovered_scalars[node] = var_sum/nb_el
23746  */
23747  __pyx_v_nb_el = (__pyx_v_nb_el + 1);
23748 
23749  /* "mprans/MeshSmoothing.pyx":1697
23750  * nodeElementOffsets[node+1]):
23751  * nb_el += 1
23752  * var_sum += scalars[nodeElementsArray[eOffset]] # <<<<<<<<<<<<<<
23753  * recovered_scalars[node] = var_sum/nb_el
23754  * return recovered_scalars
23755  */
23756  __pyx_t_15 = __pyx_v_eOffset;
23757  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_nodeElementsArray.shape[0];
23758  __pyx_t_16 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementsArray.data + __pyx_t_15 * __pyx_v_nodeElementsArray.strides[0]) )));
23759  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_scalars.shape[0];
23760  __pyx_v_var_sum = (__pyx_v_var_sum + (*((double *) ( /* dim=0 */ (__pyx_v_scalars.data + __pyx_t_16 * __pyx_v_scalars.strides[0]) ))));
23761  }
23762 
23763  /* "mprans/MeshSmoothing.pyx":1698
23764  * nb_el += 1
23765  * var_sum += scalars[nodeElementsArray[eOffset]]
23766  * recovered_scalars[node] = var_sum/nb_el # <<<<<<<<<<<<<<
23767  * return recovered_scalars
23768  *
23769  */
23770  __pyx_t_17 = __pyx_v_node;
23771  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_recovered_scalars.shape[0];
23772  *((double *) ( /* dim=0 */ (__pyx_v_recovered_scalars.data + __pyx_t_17 * __pyx_v_recovered_scalars.strides[0]) )) = (__pyx_v_var_sum / __pyx_v_nb_el);
23773  }
23774 
23775  /* "mprans/MeshSmoothing.pyx":1699
23776  * var_sum += scalars[nodeElementsArray[eOffset]]
23777  * recovered_scalars[node] = var_sum/nb_el
23778  * return recovered_scalars # <<<<<<<<<<<<<<
23779  *
23780  * cdef double[:] cyScalarRecoveryAtNodesWeighted(double[:] scalars,
23781  */
23782  __PYX_INC_MEMVIEW(&__pyx_v_recovered_scalars, 0);
23783  __pyx_r = __pyx_v_recovered_scalars;
23784  goto __pyx_L0;
23785 
23786  /* "mprans/MeshSmoothing.pyx":1682
23787  * return new_variable_nb_local
23788  *
23789  * cdef double[:] cyScalarRecoveryAtNodes(double[:] scalars, # <<<<<<<<<<<<<<
23790  * int[:] nodeElementsArray,
23791  * int[:] nodeElementOffsets):
23792  */
23793 
23794  /* function exit code */
23795  __pyx_L1_error:;
23796  __Pyx_XDECREF(__pyx_t_1);
23797  __Pyx_XDECREF(__pyx_t_2);
23798  __Pyx_XDECREF(__pyx_t_3);
23799  __Pyx_XDECREF(__pyx_t_5);
23800  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
23801  __pyx_r.data = NULL;
23802  __pyx_r.memview = NULL;
23803  __Pyx_AddTraceback("mprans.MeshSmoothing.cyScalarRecoveryAtNodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
23804  goto __pyx_L2;
23805  __pyx_L0:;
23806  if (unlikely(!__pyx_r.memview)) {
23807  PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
23808  }
23809  __pyx_L2:;
23810  __PYX_XDEC_MEMVIEW(&__pyx_v_recovered_scalars, 1);
23811  __Pyx_RefNannyFinishContext();
23812  return __pyx_r;
23813 }
23814 
23815 /* "mprans/MeshSmoothing.pyx":1701
23816  * return recovered_scalars
23817  *
23818  * cdef double[:] cyScalarRecoveryAtNodesWeighted(double[:] scalars, # <<<<<<<<<<<<<<
23819  * int[:] nodeElementsArray,
23820  * int[:] nodeElementOffsets,
23821  */
23822 
23823 static __Pyx_memviewslice __pyx_f_6mprans_13MeshSmoothing_cyScalarRecoveryAtNodesWeighted(__Pyx_memviewslice __pyx_v_scalars, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_detJ_array, int __pyx_v_nNodes) {
23824  __Pyx_memviewslice __pyx_v_recovered_scalars = { 0, 0, { 0 }, { 0 }, { 0 } };
23825  double __pyx_v_detJ_patch;
23826  double __pyx_v_scalar_sum;
23827  int __pyx_v_nb_el;
23828  int __pyx_v_node;
23829  int __pyx_v_eOffset;
23830  int __pyx_v_eN;
23831  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
23832  __Pyx_RefNannyDeclarations
23833  PyObject *__pyx_t_1 = NULL;
23834  PyObject *__pyx_t_2 = NULL;
23835  PyObject *__pyx_t_3 = NULL;
23836  PyObject *__pyx_t_4 = NULL;
23837  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
23838  int __pyx_t_6;
23839  int __pyx_t_7;
23840  int __pyx_t_8;
23841  Py_ssize_t __pyx_t_9;
23842  int __pyx_t_10;
23843  Py_ssize_t __pyx_t_11;
23844  int __pyx_t_12;
23845  int __pyx_t_13;
23846  Py_ssize_t __pyx_t_14;
23847  Py_ssize_t __pyx_t_15;
23848  Py_ssize_t __pyx_t_16;
23849  Py_ssize_t __pyx_t_17;
23850  Py_ssize_t __pyx_t_18;
23851  __Pyx_RefNannySetupContext("cyScalarRecoveryAtNodesWeighted", 0);
23852 
23853  /* "mprans/MeshSmoothing.pyx":1706
23854  * double[:] detJ_array,
23855  * int nNodes):
23856  * cdef double[:] recovered_scalars = np.zeros(nNodes) # <<<<<<<<<<<<<<
23857  * cdef double detJ_patch = 0.
23858  * cdef double scalar_sum = 0.
23859  */
23860  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1706, __pyx_L1_error)
23861  __Pyx_GOTREF(__pyx_t_2);
23862  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1706, __pyx_L1_error)
23863  __Pyx_GOTREF(__pyx_t_3);
23864  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
23865  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nNodes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1706, __pyx_L1_error)
23866  __Pyx_GOTREF(__pyx_t_2);
23867  __pyx_t_4 = NULL;
23868  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
23869  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
23870  if (likely(__pyx_t_4)) {
23871  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
23872  __Pyx_INCREF(__pyx_t_4);
23873  __Pyx_INCREF(function);
23874  __Pyx_DECREF_SET(__pyx_t_3, function);
23875  }
23876  }
23877  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
23878  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
23879  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
23880  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1706, __pyx_L1_error)
23881  __Pyx_GOTREF(__pyx_t_1);
23882  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23883  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 1706, __pyx_L1_error)
23884  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23885  __pyx_v_recovered_scalars = __pyx_t_5;
23886  __pyx_t_5.memview = NULL;
23887  __pyx_t_5.data = NULL;
23888 
23889  /* "mprans/MeshSmoothing.pyx":1707
23890  * int nNodes):
23891  * cdef double[:] recovered_scalars = np.zeros(nNodes)
23892  * cdef double detJ_patch = 0. # <<<<<<<<<<<<<<
23893  * cdef double scalar_sum = 0.
23894  * cdef int nb_el
23895  */
23896  __pyx_v_detJ_patch = 0.;
23897 
23898  /* "mprans/MeshSmoothing.pyx":1708
23899  * cdef double[:] recovered_scalars = np.zeros(nNodes)
23900  * cdef double detJ_patch = 0.
23901  * cdef double scalar_sum = 0. # <<<<<<<<<<<<<<
23902  * cdef int nb_el
23903  * cdef int node
23904  */
23905  __pyx_v_scalar_sum = 0.;
23906 
23907  /* "mprans/MeshSmoothing.pyx":1713
23908  * cdef int eOffset
23909  * cdef int eN
23910  * for node in range(nNodes): # <<<<<<<<<<<<<<
23911  * nb_el = 0
23912  * detJ_patch = 0.
23913  */
23914  __pyx_t_6 = __pyx_v_nNodes;
23915  __pyx_t_7 = __pyx_t_6;
23916  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
23917  __pyx_v_node = __pyx_t_8;
23918 
23919  /* "mprans/MeshSmoothing.pyx":1714
23920  * cdef int eN
23921  * for node in range(nNodes):
23922  * nb_el = 0 # <<<<<<<<<<<<<<
23923  * detJ_patch = 0.
23924  * scalar_sum = 0.
23925  */
23926  __pyx_v_nb_el = 0;
23927 
23928  /* "mprans/MeshSmoothing.pyx":1715
23929  * for node in range(nNodes):
23930  * nb_el = 0
23931  * detJ_patch = 0. # <<<<<<<<<<<<<<
23932  * scalar_sum = 0.
23933  * for eOffset in range(nodeElementOffsets[node],
23934  */
23935  __pyx_v_detJ_patch = 0.;
23936 
23937  /* "mprans/MeshSmoothing.pyx":1716
23938  * nb_el = 0
23939  * detJ_patch = 0.
23940  * scalar_sum = 0. # <<<<<<<<<<<<<<
23941  * for eOffset in range(nodeElementOffsets[node],
23942  * nodeElementOffsets[node+1]):
23943  */
23944  __pyx_v_scalar_sum = 0.;
23945 
23946  /* "mprans/MeshSmoothing.pyx":1718
23947  * scalar_sum = 0.
23948  * for eOffset in range(nodeElementOffsets[node],
23949  * nodeElementOffsets[node+1]): # <<<<<<<<<<<<<<
23950  * nb_el += 1
23951  * eN = nodeElementsArray[eOffset]
23952  */
23953  __pyx_t_9 = (__pyx_v_node + 1);
23954  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_nodeElementOffsets.shape[0];
23955  __pyx_t_10 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_9 * __pyx_v_nodeElementOffsets.strides[0]) )));
23956 
23957  /* "mprans/MeshSmoothing.pyx":1717
23958  * detJ_patch = 0.
23959  * scalar_sum = 0.
23960  * for eOffset in range(nodeElementOffsets[node], # <<<<<<<<<<<<<<
23961  * nodeElementOffsets[node+1]):
23962  * nb_el += 1
23963  */
23964  __pyx_t_11 = __pyx_v_node;
23965  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_nodeElementOffsets.shape[0];
23966 
23967  /* "mprans/MeshSmoothing.pyx":1718
23968  * scalar_sum = 0.
23969  * for eOffset in range(nodeElementOffsets[node],
23970  * nodeElementOffsets[node+1]): # <<<<<<<<<<<<<<
23971  * nb_el += 1
23972  * eN = nodeElementsArray[eOffset]
23973  */
23974  __pyx_t_12 = __pyx_t_10;
23975  for (__pyx_t_13 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_11 * __pyx_v_nodeElementOffsets.strides[0]) ))); __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
23976 
23977  /* "mprans/MeshSmoothing.pyx":1717
23978  * detJ_patch = 0.
23979  * scalar_sum = 0.
23980  * for eOffset in range(nodeElementOffsets[node], # <<<<<<<<<<<<<<
23981  * nodeElementOffsets[node+1]):
23982  * nb_el += 1
23983  */
23984  __pyx_v_eOffset = __pyx_t_13;
23985 
23986  /* "mprans/MeshSmoothing.pyx":1719
23987  * for eOffset in range(nodeElementOffsets[node],
23988  * nodeElementOffsets[node+1]):
23989  * nb_el += 1 # <<<<<<<<<<<<<<
23990  * eN = nodeElementsArray[eOffset]
23991  * # for k in range(n_quad):
23992  */
23993  __pyx_v_nb_el = (__pyx_v_nb_el + 1);
23994 
23995  /* "mprans/MeshSmoothing.pyx":1720
23996  * nodeElementOffsets[node+1]):
23997  * nb_el += 1
23998  * eN = nodeElementsArray[eOffset] # <<<<<<<<<<<<<<
23999  * # for k in range(n_quad):
24000  * # scalar_k = gradrads[eN, k]
24001  */
24002  __pyx_t_14 = __pyx_v_eOffset;
24003  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_nodeElementsArray.shape[0];
24004  __pyx_v_eN = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementsArray.data + __pyx_t_14 * __pyx_v_nodeElementsArray.strides[0]) )));
24005 
24006  /* "mprans/MeshSmoothing.pyx":1725
24007  * # scalar_eN_av += gradrad_k
24008  * # scalar_eN_av /= n_quad
24009  * detJ_patch += detJ_array[eN] # <<<<<<<<<<<<<<
24010  * scalar_sum += detJ_array[eN]*scalars[eN] # same value at all quad points
24011  * recovered_scalars[node] = scalar_sum/detJ_patch
24012  */
24013  __pyx_t_15 = __pyx_v_eN;
24014  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_detJ_array.shape[0];
24015  __pyx_v_detJ_patch = (__pyx_v_detJ_patch + (*((double *) ( /* dim=0 */ (__pyx_v_detJ_array.data + __pyx_t_15 * __pyx_v_detJ_array.strides[0]) ))));
24016 
24017  /* "mprans/MeshSmoothing.pyx":1726
24018  * # scalar_eN_av /= n_quad
24019  * detJ_patch += detJ_array[eN]
24020  * scalar_sum += detJ_array[eN]*scalars[eN] # same value at all quad points # <<<<<<<<<<<<<<
24021  * recovered_scalars[node] = scalar_sum/detJ_patch
24022  * return recovered_scalars
24023  */
24024  __pyx_t_16 = __pyx_v_eN;
24025  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_detJ_array.shape[0];
24026  __pyx_t_17 = __pyx_v_eN;
24027  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_scalars.shape[0];
24028  __pyx_v_scalar_sum = (__pyx_v_scalar_sum + ((*((double *) ( /* dim=0 */ (__pyx_v_detJ_array.data + __pyx_t_16 * __pyx_v_detJ_array.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_scalars.data + __pyx_t_17 * __pyx_v_scalars.strides[0]) )))));
24029  }
24030 
24031  /* "mprans/MeshSmoothing.pyx":1727
24032  * detJ_patch += detJ_array[eN]
24033  * scalar_sum += detJ_array[eN]*scalars[eN] # same value at all quad points
24034  * recovered_scalars[node] = scalar_sum/detJ_patch # <<<<<<<<<<<<<<
24035  * return recovered_scalars
24036  *
24037  */
24038  __pyx_t_18 = __pyx_v_node;
24039  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_recovered_scalars.shape[0];
24040  *((double *) ( /* dim=0 */ (__pyx_v_recovered_scalars.data + __pyx_t_18 * __pyx_v_recovered_scalars.strides[0]) )) = (__pyx_v_scalar_sum / __pyx_v_detJ_patch);
24041  }
24042 
24043  /* "mprans/MeshSmoothing.pyx":1728
24044  * scalar_sum += detJ_array[eN]*scalars[eN] # same value at all quad points
24045  * recovered_scalars[node] = scalar_sum/detJ_patch
24046  * return recovered_scalars # <<<<<<<<<<<<<<
24047  *
24048  * cdef double[:,:] cyVectorRecoveryAtNodes(double[:,:] vectors,
24049  */
24050  __PYX_INC_MEMVIEW(&__pyx_v_recovered_scalars, 0);
24051  __pyx_r = __pyx_v_recovered_scalars;
24052  goto __pyx_L0;
24053 
24054  /* "mprans/MeshSmoothing.pyx":1701
24055  * return recovered_scalars
24056  *
24057  * cdef double[:] cyScalarRecoveryAtNodesWeighted(double[:] scalars, # <<<<<<<<<<<<<<
24058  * int[:] nodeElementsArray,
24059  * int[:] nodeElementOffsets,
24060  */
24061 
24062  /* function exit code */
24063  __pyx_L1_error:;
24064  __Pyx_XDECREF(__pyx_t_1);
24065  __Pyx_XDECREF(__pyx_t_2);
24066  __Pyx_XDECREF(__pyx_t_3);
24067  __Pyx_XDECREF(__pyx_t_4);
24068  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
24069  __pyx_r.data = NULL;
24070  __pyx_r.memview = NULL;
24071  __Pyx_AddTraceback("mprans.MeshSmoothing.cyScalarRecoveryAtNodesWeighted", __pyx_clineno, __pyx_lineno, __pyx_filename);
24072  goto __pyx_L2;
24073  __pyx_L0:;
24074  if (unlikely(!__pyx_r.memview)) {
24075  PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
24076  }
24077  __pyx_L2:;
24078  __PYX_XDEC_MEMVIEW(&__pyx_v_recovered_scalars, 1);
24079  __Pyx_RefNannyFinishContext();
24080  return __pyx_r;
24081 }
24082 
24083 /* "mprans/MeshSmoothing.pyx":1730
24084  * return recovered_scalars
24085  *
24086  * cdef double[:,:] cyVectorRecoveryAtNodes(double[:,:] vectors, # <<<<<<<<<<<<<<
24087  * int[:] nodeElementsArray,
24088  * int[:] nodeElementOffsets,
24089  */
24090 
24091 static __Pyx_memviewslice __pyx_f_6mprans_13MeshSmoothing_cyVectorRecoveryAtNodes(__Pyx_memviewslice __pyx_v_vectors, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets, int __pyx_v_nd) {
24092  __Pyx_memviewslice __pyx_v_recovered_vectors = { 0, 0, { 0 }, { 0 }, { 0 } };
24093  __Pyx_memviewslice __pyx_v_vector_sum = { 0, 0, { 0 }, { 0 }, { 0 } };
24094  int __pyx_v_nNodes;
24095  int __pyx_v_nb_el;
24096  int __pyx_v_eOffset;
24097  int __pyx_v_eN;
24098  int __pyx_v_ndi;
24099  int __pyx_v_node;
24100  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
24101  __Pyx_RefNannyDeclarations
24102  PyObject *__pyx_t_1 = NULL;
24103  PyObject *__pyx_t_2 = NULL;
24104  PyObject *__pyx_t_3 = NULL;
24105  PyObject *__pyx_t_4 = NULL;
24106  PyObject *__pyx_t_5 = NULL;
24107  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
24108  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
24109  int __pyx_t_8;
24110  int __pyx_t_9;
24111  int __pyx_t_10;
24112  int __pyx_t_11;
24113  int __pyx_t_12;
24114  int __pyx_t_13;
24115  Py_ssize_t __pyx_t_14;
24116  Py_ssize_t __pyx_t_15;
24117  Py_ssize_t __pyx_t_16;
24118  Py_ssize_t __pyx_t_17;
24119  int __pyx_t_18;
24120  int __pyx_t_19;
24121  int __pyx_t_20;
24122  Py_ssize_t __pyx_t_21;
24123  Py_ssize_t __pyx_t_22;
24124  Py_ssize_t __pyx_t_23;
24125  Py_ssize_t __pyx_t_24;
24126  Py_ssize_t __pyx_t_25;
24127  Py_ssize_t __pyx_t_26;
24128  __Pyx_RefNannySetupContext("cyVectorRecoveryAtNodes", 0);
24129 
24130  /* "mprans/MeshSmoothing.pyx":1734
24131  * int[:] nodeElementOffsets,
24132  * int nd):
24133  * cdef double[:, :] recovered_vectors = np.zeros((nodeElementOffsets.shape[0]-1, nd)) # <<<<<<<<<<<<<<
24134  * cdef double[:] vector_sum = np.zeros(nd)
24135  * cdef int nNodes = nodeElementOffsets.shape[0]-1
24136  */
24137  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1734, __pyx_L1_error)
24138  __Pyx_GOTREF(__pyx_t_2);
24139  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1734, __pyx_L1_error)
24140  __Pyx_GOTREF(__pyx_t_3);
24141  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
24142  __pyx_t_2 = PyInt_FromSsize_t(((__pyx_v_nodeElementOffsets.shape[0]) - 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1734, __pyx_L1_error)
24143  __Pyx_GOTREF(__pyx_t_2);
24144  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_nd); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1734, __pyx_L1_error)
24145  __Pyx_GOTREF(__pyx_t_4);
24146  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1734, __pyx_L1_error)
24147  __Pyx_GOTREF(__pyx_t_5);
24148  __Pyx_GIVEREF(__pyx_t_2);
24149  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
24150  __Pyx_GIVEREF(__pyx_t_4);
24151  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
24152  __pyx_t_2 = 0;
24153  __pyx_t_4 = 0;
24154  __pyx_t_4 = NULL;
24155  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
24156  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
24157  if (likely(__pyx_t_4)) {
24158  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
24159  __Pyx_INCREF(__pyx_t_4);
24160  __Pyx_INCREF(function);
24161  __Pyx_DECREF_SET(__pyx_t_3, function);
24162  }
24163  }
24164  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5);
24165  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
24166  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
24167  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1734, __pyx_L1_error)
24168  __Pyx_GOTREF(__pyx_t_1);
24169  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
24170  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1734, __pyx_L1_error)
24171  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24172  __pyx_v_recovered_vectors = __pyx_t_6;
24173  __pyx_t_6.memview = NULL;
24174  __pyx_t_6.data = NULL;
24175 
24176  /* "mprans/MeshSmoothing.pyx":1735
24177  * int nd):
24178  * cdef double[:, :] recovered_vectors = np.zeros((nodeElementOffsets.shape[0]-1, nd))
24179  * cdef double[:] vector_sum = np.zeros(nd) # <<<<<<<<<<<<<<
24180  * cdef int nNodes = nodeElementOffsets.shape[0]-1
24181  * cdef int nb_el
24182  */
24183  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1735, __pyx_L1_error)
24184  __Pyx_GOTREF(__pyx_t_3);
24185  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1735, __pyx_L1_error)
24186  __Pyx_GOTREF(__pyx_t_5);
24187  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
24188  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nd); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1735, __pyx_L1_error)
24189  __Pyx_GOTREF(__pyx_t_3);
24190  __pyx_t_4 = NULL;
24191  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
24192  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
24193  if (likely(__pyx_t_4)) {
24194  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
24195  __Pyx_INCREF(__pyx_t_4);
24196  __Pyx_INCREF(function);
24197  __Pyx_DECREF_SET(__pyx_t_5, function);
24198  }
24199  }
24200  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3);
24201  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
24202  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
24203  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1735, __pyx_L1_error)
24204  __Pyx_GOTREF(__pyx_t_1);
24205  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
24206  __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 1735, __pyx_L1_error)
24207  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24208  __pyx_v_vector_sum = __pyx_t_7;
24209  __pyx_t_7.memview = NULL;
24210  __pyx_t_7.data = NULL;
24211 
24212  /* "mprans/MeshSmoothing.pyx":1736
24213  * cdef double[:, :] recovered_vectors = np.zeros((nodeElementOffsets.shape[0]-1, nd))
24214  * cdef double[:] vector_sum = np.zeros(nd)
24215  * cdef int nNodes = nodeElementOffsets.shape[0]-1 # <<<<<<<<<<<<<<
24216  * cdef int nb_el
24217  * cdef int eOffset
24218  */
24219  __pyx_v_nNodes = ((__pyx_v_nodeElementOffsets.shape[0]) - 1);
24220 
24221  /* "mprans/MeshSmoothing.pyx":1742
24222  * cdef int ndi
24223  * cdef int node
24224  * for node in range(nNodes): # <<<<<<<<<<<<<<
24225  * nb_el = 0
24226  * for ndi in range(nd):
24227  */
24228  __pyx_t_8 = __pyx_v_nNodes;
24229  __pyx_t_9 = __pyx_t_8;
24230  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
24231  __pyx_v_node = __pyx_t_10;
24232 
24233  /* "mprans/MeshSmoothing.pyx":1743
24234  * cdef int node
24235  * for node in range(nNodes):
24236  * nb_el = 0 # <<<<<<<<<<<<<<
24237  * for ndi in range(nd):
24238  * vector_sum[ndi] = 0.
24239  */
24240  __pyx_v_nb_el = 0;
24241 
24242  /* "mprans/MeshSmoothing.pyx":1744
24243  * for node in range(nNodes):
24244  * nb_el = 0
24245  * for ndi in range(nd): # <<<<<<<<<<<<<<
24246  * vector_sum[ndi] = 0.
24247  * for eOffset in range(nodeElementOffsets[node],
24248  */
24249  __pyx_t_11 = __pyx_v_nd;
24250  __pyx_t_12 = __pyx_t_11;
24251  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
24252  __pyx_v_ndi = __pyx_t_13;
24253 
24254  /* "mprans/MeshSmoothing.pyx":1745
24255  * nb_el = 0
24256  * for ndi in range(nd):
24257  * vector_sum[ndi] = 0. # <<<<<<<<<<<<<<
24258  * for eOffset in range(nodeElementOffsets[node],
24259  * nodeElementOffsets[node+1]):
24260  */
24261  __pyx_t_14 = __pyx_v_ndi;
24262  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_vector_sum.shape[0];
24263  *((double *) ( /* dim=0 */ (__pyx_v_vector_sum.data + __pyx_t_14 * __pyx_v_vector_sum.strides[0]) )) = 0.;
24264  }
24265 
24266  /* "mprans/MeshSmoothing.pyx":1747
24267  * vector_sum[ndi] = 0.
24268  * for eOffset in range(nodeElementOffsets[node],
24269  * nodeElementOffsets[node+1]): # <<<<<<<<<<<<<<
24270  * nb_el += 1
24271  * eN = nodeElementsArray[eOffset]
24272  */
24273  __pyx_t_15 = (__pyx_v_node + 1);
24274  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_nodeElementOffsets.shape[0];
24275  __pyx_t_11 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_15 * __pyx_v_nodeElementOffsets.strides[0]) )));
24276 
24277  /* "mprans/MeshSmoothing.pyx":1746
24278  * for ndi in range(nd):
24279  * vector_sum[ndi] = 0.
24280  * for eOffset in range(nodeElementOffsets[node], # <<<<<<<<<<<<<<
24281  * nodeElementOffsets[node+1]):
24282  * nb_el += 1
24283  */
24284  __pyx_t_16 = __pyx_v_node;
24285  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nodeElementOffsets.shape[0];
24286 
24287  /* "mprans/MeshSmoothing.pyx":1747
24288  * vector_sum[ndi] = 0.
24289  * for eOffset in range(nodeElementOffsets[node],
24290  * nodeElementOffsets[node+1]): # <<<<<<<<<<<<<<
24291  * nb_el += 1
24292  * eN = nodeElementsArray[eOffset]
24293  */
24294  __pyx_t_12 = __pyx_t_11;
24295  for (__pyx_t_13 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_16 * __pyx_v_nodeElementOffsets.strides[0]) ))); __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
24296 
24297  /* "mprans/MeshSmoothing.pyx":1746
24298  * for ndi in range(nd):
24299  * vector_sum[ndi] = 0.
24300  * for eOffset in range(nodeElementOffsets[node], # <<<<<<<<<<<<<<
24301  * nodeElementOffsets[node+1]):
24302  * nb_el += 1
24303  */
24304  __pyx_v_eOffset = __pyx_t_13;
24305 
24306  /* "mprans/MeshSmoothing.pyx":1748
24307  * for eOffset in range(nodeElementOffsets[node],
24308  * nodeElementOffsets[node+1]):
24309  * nb_el += 1 # <<<<<<<<<<<<<<
24310  * eN = nodeElementsArray[eOffset]
24311  * # for k in range(n_quad):
24312  */
24313  __pyx_v_nb_el = (__pyx_v_nb_el + 1);
24314 
24315  /* "mprans/MeshSmoothing.pyx":1749
24316  * nodeElementOffsets[node+1]):
24317  * nb_el += 1
24318  * eN = nodeElementsArray[eOffset] # <<<<<<<<<<<<<<
24319  * # for k in range(n_quad):
24320  * # vector_k = vectors[eN, k]
24321  */
24322  __pyx_t_17 = __pyx_v_eOffset;
24323  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_nodeElementsArray.shape[0];
24324  __pyx_v_eN = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementsArray.data + __pyx_t_17 * __pyx_v_nodeElementsArray.strides[0]) )));
24325 
24326  /* "mprans/MeshSmoothing.pyx":1754
24327  * # vector_eN_av += vector_k
24328  * # vector_eN_av /= n_quad
24329  * for ndi in range(nd): # <<<<<<<<<<<<<<
24330  * vector_sum[ndi] += vectors[eN, ndi] # same value at all quad points
24331  * for ndi in range(nd):
24332  */
24333  __pyx_t_18 = __pyx_v_nd;
24334  __pyx_t_19 = __pyx_t_18;
24335  for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
24336  __pyx_v_ndi = __pyx_t_20;
24337 
24338  /* "mprans/MeshSmoothing.pyx":1755
24339  * # vector_eN_av /= n_quad
24340  * for ndi in range(nd):
24341  * vector_sum[ndi] += vectors[eN, ndi] # same value at all quad points # <<<<<<<<<<<<<<
24342  * for ndi in range(nd):
24343  * recovered_vectors[node, ndi] = vector_sum[ndi]/nb_el
24344  */
24345  __pyx_t_21 = __pyx_v_eN;
24346  __pyx_t_22 = __pyx_v_ndi;
24347  if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_vectors.shape[0];
24348  if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_vectors.shape[1];
24349  __pyx_t_23 = __pyx_v_ndi;
24350  if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_vector_sum.shape[0];
24351  *((double *) ( /* dim=0 */ (__pyx_v_vector_sum.data + __pyx_t_23 * __pyx_v_vector_sum.strides[0]) )) += (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vectors.data + __pyx_t_21 * __pyx_v_vectors.strides[0]) ) + __pyx_t_22 * __pyx_v_vectors.strides[1]) )));
24352  }
24353  }
24354 
24355  /* "mprans/MeshSmoothing.pyx":1756
24356  * for ndi in range(nd):
24357  * vector_sum[ndi] += vectors[eN, ndi] # same value at all quad points
24358  * for ndi in range(nd): # <<<<<<<<<<<<<<
24359  * recovered_vectors[node, ndi] = vector_sum[ndi]/nb_el
24360  * return recovered_vectors
24361  */
24362  __pyx_t_11 = __pyx_v_nd;
24363  __pyx_t_12 = __pyx_t_11;
24364  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
24365  __pyx_v_ndi = __pyx_t_13;
24366 
24367  /* "mprans/MeshSmoothing.pyx":1757
24368  * vector_sum[ndi] += vectors[eN, ndi] # same value at all quad points
24369  * for ndi in range(nd):
24370  * recovered_vectors[node, ndi] = vector_sum[ndi]/nb_el # <<<<<<<<<<<<<<
24371  * return recovered_vectors
24372  *
24373  */
24374  __pyx_t_24 = __pyx_v_ndi;
24375  if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_vector_sum.shape[0];
24376  __pyx_t_25 = __pyx_v_node;
24377  __pyx_t_26 = __pyx_v_ndi;
24378  if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_recovered_vectors.shape[0];
24379  if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_recovered_vectors.shape[1];
24380  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_recovered_vectors.data + __pyx_t_25 * __pyx_v_recovered_vectors.strides[0]) ) + __pyx_t_26 * __pyx_v_recovered_vectors.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vector_sum.data + __pyx_t_24 * __pyx_v_vector_sum.strides[0]) ))) / __pyx_v_nb_el);
24381  }
24382  }
24383 
24384  /* "mprans/MeshSmoothing.pyx":1758
24385  * for ndi in range(nd):
24386  * recovered_vectors[node, ndi] = vector_sum[ndi]/nb_el
24387  * return recovered_vectors # <<<<<<<<<<<<<<
24388  *
24389  * cdef double[:,:] cyVectorRecoveryAtNodesWeighted(double[:,:] vectors,
24390  */
24391  __PYX_INC_MEMVIEW(&__pyx_v_recovered_vectors, 0);
24392  __pyx_r = __pyx_v_recovered_vectors;
24393  goto __pyx_L0;
24394 
24395  /* "mprans/MeshSmoothing.pyx":1730
24396  * return recovered_scalars
24397  *
24398  * cdef double[:,:] cyVectorRecoveryAtNodes(double[:,:] vectors, # <<<<<<<<<<<<<<
24399  * int[:] nodeElementsArray,
24400  * int[:] nodeElementOffsets,
24401  */
24402 
24403  /* function exit code */
24404  __pyx_L1_error:;
24405  __Pyx_XDECREF(__pyx_t_1);
24406  __Pyx_XDECREF(__pyx_t_2);
24407  __Pyx_XDECREF(__pyx_t_3);
24408  __Pyx_XDECREF(__pyx_t_4);
24409  __Pyx_XDECREF(__pyx_t_5);
24410  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
24411  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
24412  __pyx_r.data = NULL;
24413  __pyx_r.memview = NULL;
24414  __Pyx_AddTraceback("mprans.MeshSmoothing.cyVectorRecoveryAtNodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
24415  goto __pyx_L2;
24416  __pyx_L0:;
24417  if (unlikely(!__pyx_r.memview)) {
24418  PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
24419  }
24420  __pyx_L2:;
24421  __PYX_XDEC_MEMVIEW(&__pyx_v_recovered_vectors, 1);
24422  __PYX_XDEC_MEMVIEW(&__pyx_v_vector_sum, 1);
24423  __Pyx_RefNannyFinishContext();
24424  return __pyx_r;
24425 }
24426 
24427 /* "mprans/MeshSmoothing.pyx":1760
24428  * return recovered_vectors
24429  *
24430  * cdef double[:,:] cyVectorRecoveryAtNodesWeighted(double[:,:] vectors, # <<<<<<<<<<<<<<
24431  * int[:] nodeElementsArray,
24432  * int[:] nodeElementOffsets,
24433  */
24434 
24435 static __Pyx_memviewslice __pyx_f_6mprans_13MeshSmoothing_cyVectorRecoveryAtNodesWeighted(__Pyx_memviewslice __pyx_v_vectors, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_detJ_array, int __pyx_v_nd) {
24436  __Pyx_memviewslice __pyx_v_recovered_vectors = { 0, 0, { 0 }, { 0 }, { 0 } };
24437  __Pyx_memviewslice __pyx_v_vector_sum = { 0, 0, { 0 }, { 0 }, { 0 } };
24438  int __pyx_v_nNodes;
24439  double __pyx_v_detJ_patch;
24440  int __pyx_v_nb_el;
24441  int __pyx_v_eN;
24442  int __pyx_v_ndi;
24443  int __pyx_v_node;
24444  int __pyx_v_eOffset;
24445  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
24446  __Pyx_RefNannyDeclarations
24447  PyObject *__pyx_t_1 = NULL;
24448  PyObject *__pyx_t_2 = NULL;
24449  PyObject *__pyx_t_3 = NULL;
24450  size_t __pyx_t_4;
24451  PyObject *__pyx_t_5 = NULL;
24452  PyObject *__pyx_t_6 = NULL;
24453  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
24454  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
24455  int __pyx_t_9;
24456  int __pyx_t_10;
24457  int __pyx_t_11;
24458  int __pyx_t_12;
24459  int __pyx_t_13;
24460  int __pyx_t_14;
24461  Py_ssize_t __pyx_t_15;
24462  Py_ssize_t __pyx_t_16;
24463  Py_ssize_t __pyx_t_17;
24464  Py_ssize_t __pyx_t_18;
24465  Py_ssize_t __pyx_t_19;
24466  Py_ssize_t __pyx_t_20;
24467  int __pyx_t_21;
24468  int __pyx_t_22;
24469  int __pyx_t_23;
24470  Py_ssize_t __pyx_t_24;
24471  Py_ssize_t __pyx_t_25;
24472  Py_ssize_t __pyx_t_26;
24473  Py_ssize_t __pyx_t_27;
24474  Py_ssize_t __pyx_t_28;
24475  Py_ssize_t __pyx_t_29;
24476  Py_ssize_t __pyx_t_30;
24477  Py_ssize_t __pyx_t_31;
24478  __Pyx_RefNannySetupContext("cyVectorRecoveryAtNodesWeighted", 0);
24479 
24480  /* "mprans/MeshSmoothing.pyx":1765
24481  * double[:,:] detJ_array,
24482  * int nd):
24483  * cdef double[:, :] recovered_vectors = np.zeros((len(nodeElementOffsets)-1, nd)) # <<<<<<<<<<<<<<
24484  * cdef double[:] vector_sum = np.zeros(nd)
24485  * cdef int nNodes = nodeElementOffsets.shape[0]-1
24486  */
24487  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1765, __pyx_L1_error)
24488  __Pyx_GOTREF(__pyx_t_2);
24489  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1765, __pyx_L1_error)
24490  __Pyx_GOTREF(__pyx_t_3);
24491  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
24492  __pyx_t_4 = __Pyx_MemoryView_Len(__pyx_v_nodeElementOffsets);
24493  __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_4 - 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1765, __pyx_L1_error)
24494  __Pyx_GOTREF(__pyx_t_2);
24495  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_nd); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1765, __pyx_L1_error)
24496  __Pyx_GOTREF(__pyx_t_5);
24497  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1765, __pyx_L1_error)
24498  __Pyx_GOTREF(__pyx_t_6);
24499  __Pyx_GIVEREF(__pyx_t_2);
24500  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
24501  __Pyx_GIVEREF(__pyx_t_5);
24502  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
24503  __pyx_t_2 = 0;
24504  __pyx_t_5 = 0;
24505  __pyx_t_5 = NULL;
24506  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
24507  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
24508  if (likely(__pyx_t_5)) {
24509  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
24510  __Pyx_INCREF(__pyx_t_5);
24511  __Pyx_INCREF(function);
24512  __Pyx_DECREF_SET(__pyx_t_3, function);
24513  }
24514  }
24515  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6);
24516  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
24517  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
24518  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1765, __pyx_L1_error)
24519  __Pyx_GOTREF(__pyx_t_1);
24520  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
24521  __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 1765, __pyx_L1_error)
24522  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24523  __pyx_v_recovered_vectors = __pyx_t_7;
24524  __pyx_t_7.memview = NULL;
24525  __pyx_t_7.data = NULL;
24526 
24527  /* "mprans/MeshSmoothing.pyx":1766
24528  * int nd):
24529  * cdef double[:, :] recovered_vectors = np.zeros((len(nodeElementOffsets)-1, nd))
24530  * cdef double[:] vector_sum = np.zeros(nd) # <<<<<<<<<<<<<<
24531  * cdef int nNodes = nodeElementOffsets.shape[0]-1
24532  * cdef double detJ_patch = 0.
24533  */
24534  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1766, __pyx_L1_error)
24535  __Pyx_GOTREF(__pyx_t_3);
24536  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1766, __pyx_L1_error)
24537  __Pyx_GOTREF(__pyx_t_6);
24538  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
24539  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nd); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1766, __pyx_L1_error)
24540  __Pyx_GOTREF(__pyx_t_3);
24541  __pyx_t_5 = NULL;
24542  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
24543  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
24544  if (likely(__pyx_t_5)) {
24545  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
24546  __Pyx_INCREF(__pyx_t_5);
24547  __Pyx_INCREF(function);
24548  __Pyx_DECREF_SET(__pyx_t_6, function);
24549  }
24550  }
24551  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3);
24552  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
24553  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
24554  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1766, __pyx_L1_error)
24555  __Pyx_GOTREF(__pyx_t_1);
24556  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
24557  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 1766, __pyx_L1_error)
24558  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24559  __pyx_v_vector_sum = __pyx_t_8;
24560  __pyx_t_8.memview = NULL;
24561  __pyx_t_8.data = NULL;
24562 
24563  /* "mprans/MeshSmoothing.pyx":1767
24564  * cdef double[:, :] recovered_vectors = np.zeros((len(nodeElementOffsets)-1, nd))
24565  * cdef double[:] vector_sum = np.zeros(nd)
24566  * cdef int nNodes = nodeElementOffsets.shape[0]-1 # <<<<<<<<<<<<<<
24567  * cdef double detJ_patch = 0.
24568  * cdef int nb_el
24569  */
24570  __pyx_v_nNodes = ((__pyx_v_nodeElementOffsets.shape[0]) - 1);
24571 
24572  /* "mprans/MeshSmoothing.pyx":1768
24573  * cdef double[:] vector_sum = np.zeros(nd)
24574  * cdef int nNodes = nodeElementOffsets.shape[0]-1
24575  * cdef double detJ_patch = 0. # <<<<<<<<<<<<<<
24576  * cdef int nb_el
24577  * cdef int eN
24578  */
24579  __pyx_v_detJ_patch = 0.;
24580 
24581  /* "mprans/MeshSmoothing.pyx":1774
24582  * cdef int node
24583  * cdef int eOffset
24584  * for node in range(nNodes): # <<<<<<<<<<<<<<
24585  * nb_el = 0
24586  * detJ_patch = 0.
24587  */
24588  __pyx_t_9 = __pyx_v_nNodes;
24589  __pyx_t_10 = __pyx_t_9;
24590  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
24591  __pyx_v_node = __pyx_t_11;
24592 
24593  /* "mprans/MeshSmoothing.pyx":1775
24594  * cdef int eOffset
24595  * for node in range(nNodes):
24596  * nb_el = 0 # <<<<<<<<<<<<<<
24597  * detJ_patch = 0.
24598  * for ndi in range(nd):
24599  */
24600  __pyx_v_nb_el = 0;
24601 
24602  /* "mprans/MeshSmoothing.pyx":1776
24603  * for node in range(nNodes):
24604  * nb_el = 0
24605  * detJ_patch = 0. # <<<<<<<<<<<<<<
24606  * for ndi in range(nd):
24607  * vector_sum[ndi] = 0.
24608  */
24609  __pyx_v_detJ_patch = 0.;
24610 
24611  /* "mprans/MeshSmoothing.pyx":1777
24612  * nb_el = 0
24613  * detJ_patch = 0.
24614  * for ndi in range(nd): # <<<<<<<<<<<<<<
24615  * vector_sum[ndi] = 0.
24616  * for eOffset in range(nodeElementOffsets[node],
24617  */
24618  __pyx_t_12 = __pyx_v_nd;
24619  __pyx_t_13 = __pyx_t_12;
24620  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
24621  __pyx_v_ndi = __pyx_t_14;
24622 
24623  /* "mprans/MeshSmoothing.pyx":1778
24624  * detJ_patch = 0.
24625  * for ndi in range(nd):
24626  * vector_sum[ndi] = 0. # <<<<<<<<<<<<<<
24627  * for eOffset in range(nodeElementOffsets[node],
24628  * nodeElementOffsets[node+1]):
24629  */
24630  __pyx_t_15 = __pyx_v_ndi;
24631  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_vector_sum.shape[0];
24632  *((double *) ( /* dim=0 */ (__pyx_v_vector_sum.data + __pyx_t_15 * __pyx_v_vector_sum.strides[0]) )) = 0.;
24633  }
24634 
24635  /* "mprans/MeshSmoothing.pyx":1780
24636  * vector_sum[ndi] = 0.
24637  * for eOffset in range(nodeElementOffsets[node],
24638  * nodeElementOffsets[node+1]): # <<<<<<<<<<<<<<
24639  * nb_el += 1
24640  * eN = nodeElementsArray[eOffset]
24641  */
24642  __pyx_t_16 = (__pyx_v_node + 1);
24643  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nodeElementOffsets.shape[0];
24644  __pyx_t_12 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_16 * __pyx_v_nodeElementOffsets.strides[0]) )));
24645 
24646  /* "mprans/MeshSmoothing.pyx":1779
24647  * for ndi in range(nd):
24648  * vector_sum[ndi] = 0.
24649  * for eOffset in range(nodeElementOffsets[node], # <<<<<<<<<<<<<<
24650  * nodeElementOffsets[node+1]):
24651  * nb_el += 1
24652  */
24653  __pyx_t_17 = __pyx_v_node;
24654  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_nodeElementOffsets.shape[0];
24655 
24656  /* "mprans/MeshSmoothing.pyx":1780
24657  * vector_sum[ndi] = 0.
24658  * for eOffset in range(nodeElementOffsets[node],
24659  * nodeElementOffsets[node+1]): # <<<<<<<<<<<<<<
24660  * nb_el += 1
24661  * eN = nodeElementsArray[eOffset]
24662  */
24663  __pyx_t_13 = __pyx_t_12;
24664  for (__pyx_t_14 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_17 * __pyx_v_nodeElementOffsets.strides[0]) ))); __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
24665 
24666  /* "mprans/MeshSmoothing.pyx":1779
24667  * for ndi in range(nd):
24668  * vector_sum[ndi] = 0.
24669  * for eOffset in range(nodeElementOffsets[node], # <<<<<<<<<<<<<<
24670  * nodeElementOffsets[node+1]):
24671  * nb_el += 1
24672  */
24673  __pyx_v_eOffset = __pyx_t_14;
24674 
24675  /* "mprans/MeshSmoothing.pyx":1781
24676  * for eOffset in range(nodeElementOffsets[node],
24677  * nodeElementOffsets[node+1]):
24678  * nb_el += 1 # <<<<<<<<<<<<<<
24679  * eN = nodeElementsArray[eOffset]
24680  * # for k in range(n_quad):
24681  */
24682  __pyx_v_nb_el = (__pyx_v_nb_el + 1);
24683 
24684  /* "mprans/MeshSmoothing.pyx":1782
24685  * nodeElementOffsets[node+1]):
24686  * nb_el += 1
24687  * eN = nodeElementsArray[eOffset] # <<<<<<<<<<<<<<
24688  * # for k in range(n_quad):
24689  * # vector_k = vectors[eN, k]
24690  */
24691  __pyx_t_18 = __pyx_v_eOffset;
24692  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_nodeElementsArray.shape[0];
24693  __pyx_v_eN = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementsArray.data + __pyx_t_18 * __pyx_v_nodeElementsArray.strides[0]) )));
24694 
24695  /* "mprans/MeshSmoothing.pyx":1787
24696  * # vector_eN_av += vector_k
24697  * # vector_eN_av /= n_quad
24698  * detJ_patch += detJ_array[eN,0] # <<<<<<<<<<<<<<
24699  * for ndi in range(nd):
24700  * vector_sum[ndi] += detJ_array[eN,0]*vectors[eN, ndi] # same value at all quad points
24701  */
24702  __pyx_t_19 = __pyx_v_eN;
24703  __pyx_t_20 = 0;
24704  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_detJ_array.shape[0];
24705  if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_detJ_array.shape[1];
24706  __pyx_v_detJ_patch = (__pyx_v_detJ_patch + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_detJ_array.data + __pyx_t_19 * __pyx_v_detJ_array.strides[0]) ) + __pyx_t_20 * __pyx_v_detJ_array.strides[1]) ))));
24707 
24708  /* "mprans/MeshSmoothing.pyx":1788
24709  * # vector_eN_av /= n_quad
24710  * detJ_patch += detJ_array[eN,0]
24711  * for ndi in range(nd): # <<<<<<<<<<<<<<
24712  * vector_sum[ndi] += detJ_array[eN,0]*vectors[eN, ndi] # same value at all quad points
24713  * for ndi in range(nd):
24714  */
24715  __pyx_t_21 = __pyx_v_nd;
24716  __pyx_t_22 = __pyx_t_21;
24717  for (__pyx_t_23 = 0; __pyx_t_23 < __pyx_t_22; __pyx_t_23+=1) {
24718  __pyx_v_ndi = __pyx_t_23;
24719 
24720  /* "mprans/MeshSmoothing.pyx":1789
24721  * detJ_patch += detJ_array[eN,0]
24722  * for ndi in range(nd):
24723  * vector_sum[ndi] += detJ_array[eN,0]*vectors[eN, ndi] # same value at all quad points # <<<<<<<<<<<<<<
24724  * for ndi in range(nd):
24725  * recovered_vectors[node, ndi] = vector_sum[ndi]/detJ_patch
24726  */
24727  __pyx_t_24 = __pyx_v_eN;
24728  __pyx_t_25 = 0;
24729  if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_detJ_array.shape[0];
24730  if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_detJ_array.shape[1];
24731  __pyx_t_26 = __pyx_v_eN;
24732  __pyx_t_27 = __pyx_v_ndi;
24733  if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_vectors.shape[0];
24734  if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_vectors.shape[1];
24735  __pyx_t_28 = __pyx_v_ndi;
24736  if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_vector_sum.shape[0];
24737  *((double *) ( /* dim=0 */ (__pyx_v_vector_sum.data + __pyx_t_28 * __pyx_v_vector_sum.strides[0]) )) += ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_detJ_array.data + __pyx_t_24 * __pyx_v_detJ_array.strides[0]) ) + __pyx_t_25 * __pyx_v_detJ_array.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vectors.data + __pyx_t_26 * __pyx_v_vectors.strides[0]) ) + __pyx_t_27 * __pyx_v_vectors.strides[1]) ))));
24738  }
24739  }
24740 
24741  /* "mprans/MeshSmoothing.pyx":1790
24742  * for ndi in range(nd):
24743  * vector_sum[ndi] += detJ_array[eN,0]*vectors[eN, ndi] # same value at all quad points
24744  * for ndi in range(nd): # <<<<<<<<<<<<<<
24745  * recovered_vectors[node, ndi] = vector_sum[ndi]/detJ_patch
24746  * return recovered_vectors
24747  */
24748  __pyx_t_12 = __pyx_v_nd;
24749  __pyx_t_13 = __pyx_t_12;
24750  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
24751  __pyx_v_ndi = __pyx_t_14;
24752 
24753  /* "mprans/MeshSmoothing.pyx":1791
24754  * vector_sum[ndi] += detJ_array[eN,0]*vectors[eN, ndi] # same value at all quad points
24755  * for ndi in range(nd):
24756  * recovered_vectors[node, ndi] = vector_sum[ndi]/detJ_patch # <<<<<<<<<<<<<<
24757  * return recovered_vectors
24758  */
24759  __pyx_t_29 = __pyx_v_ndi;
24760  if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_vector_sum.shape[0];
24761  __pyx_t_30 = __pyx_v_node;
24762  __pyx_t_31 = __pyx_v_ndi;
24763  if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_recovered_vectors.shape[0];
24764  if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_recovered_vectors.shape[1];
24765  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_recovered_vectors.data + __pyx_t_30 * __pyx_v_recovered_vectors.strides[0]) ) + __pyx_t_31 * __pyx_v_recovered_vectors.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vector_sum.data + __pyx_t_29 * __pyx_v_vector_sum.strides[0]) ))) / __pyx_v_detJ_patch);
24766  }
24767  }
24768 
24769  /* "mprans/MeshSmoothing.pyx":1792
24770  * for ndi in range(nd):
24771  * recovered_vectors[node, ndi] = vector_sum[ndi]/detJ_patch
24772  * return recovered_vectors # <<<<<<<<<<<<<<
24773  */
24774  __PYX_INC_MEMVIEW(&__pyx_v_recovered_vectors, 0);
24775  __pyx_r = __pyx_v_recovered_vectors;
24776  goto __pyx_L0;
24777 
24778  /* "mprans/MeshSmoothing.pyx":1760
24779  * return recovered_vectors
24780  *
24781  * cdef double[:,:] cyVectorRecoveryAtNodesWeighted(double[:,:] vectors, # <<<<<<<<<<<<<<
24782  * int[:] nodeElementsArray,
24783  * int[:] nodeElementOffsets,
24784  */
24785 
24786  /* function exit code */
24787  __pyx_L1_error:;
24788  __Pyx_XDECREF(__pyx_t_1);
24789  __Pyx_XDECREF(__pyx_t_2);
24790  __Pyx_XDECREF(__pyx_t_3);
24791  __Pyx_XDECREF(__pyx_t_5);
24792  __Pyx_XDECREF(__pyx_t_6);
24793  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
24794  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
24795  __pyx_r.data = NULL;
24796  __pyx_r.memview = NULL;
24797  __Pyx_AddTraceback("mprans.MeshSmoothing.cyVectorRecoveryAtNodesWeighted", __pyx_clineno, __pyx_lineno, __pyx_filename);
24798  goto __pyx_L2;
24799  __pyx_L0:;
24800  if (unlikely(!__pyx_r.memview)) {
24801  PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
24802  }
24803  __pyx_L2:;
24804  __PYX_XDEC_MEMVIEW(&__pyx_v_recovered_vectors, 1);
24805  __PYX_XDEC_MEMVIEW(&__pyx_v_vector_sum, 1);
24806  __Pyx_RefNannyFinishContext();
24807  return __pyx_r;
24808 }
24809 
24810 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":258
24811  * # experimental exception made for __getbuffer__ and __releasebuffer__
24812  * # -- the details of this may change.
24813  * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
24814  * # This implementation of getbuffer is geared towards Cython
24815  * # requirements, and does not yet fulfill the PEP.
24816  */
24817 
24818 /* Python wrapper */
24819 static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
24820 static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
24821  int __pyx_r;
24822  __Pyx_RefNannyDeclarations
24823  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
24824  __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
24825 
24826  /* function exit code */
24827  __Pyx_RefNannyFinishContext();
24828  return __pyx_r;
24829 }
24830 
24831 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
24832  int __pyx_v_i;
24833  int __pyx_v_ndim;
24834  int __pyx_v_endian_detector;
24835  int __pyx_v_little_endian;
24836  int __pyx_v_t;
24837  char *__pyx_v_f;
24838  PyArray_Descr *__pyx_v_descr = 0;
24839  int __pyx_v_offset;
24840  int __pyx_r;
24841  __Pyx_RefNannyDeclarations
24842  int __pyx_t_1;
24843  int __pyx_t_2;
24844  PyObject *__pyx_t_3 = NULL;
24845  int __pyx_t_4;
24846  int __pyx_t_5;
24847  int __pyx_t_6;
24848  PyArray_Descr *__pyx_t_7;
24849  PyObject *__pyx_t_8 = NULL;
24850  char *__pyx_t_9;
24851  if (__pyx_v_info == NULL) {
24852  PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
24853  return -1;
24854  }
24855  __Pyx_RefNannySetupContext("__getbuffer__", 0);
24856  __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
24857  __Pyx_GIVEREF(__pyx_v_info->obj);
24858 
24859  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":265
24860  *
24861  * cdef int i, ndim
24862  * cdef int endian_detector = 1 # <<<<<<<<<<<<<<
24863  * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
24864  *
24865  */
24866  __pyx_v_endian_detector = 1;
24867 
24868  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":266
24869  * cdef int i, ndim
24870  * cdef int endian_detector = 1
24871  * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
24872  *
24873  * ndim = PyArray_NDIM(self)
24874  */
24875  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
24876 
24877  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":268
24878  * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
24879  *
24880  * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<<
24881  *
24882  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
24883  */
24884  __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);
24885 
24886  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":270
24887  * ndim = PyArray_NDIM(self)
24888  *
24889  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
24890  * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
24891  * raise ValueError(u"ndarray is not C contiguous")
24892  */
24893  __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
24894  if (__pyx_t_2) {
24895  } else {
24896  __pyx_t_1 = __pyx_t_2;
24897  goto __pyx_L4_bool_binop_done;
24898  }
24899 
24900  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":271
24901  *
24902  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
24903  * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): # <<<<<<<<<<<<<<
24904  * raise ValueError(u"ndarray is not C contiguous")
24905  *
24906  */
24907  __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_C_CONTIGUOUS) != 0)) != 0);
24908  __pyx_t_1 = __pyx_t_2;
24909  __pyx_L4_bool_binop_done:;
24910 
24911  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":270
24912  * ndim = PyArray_NDIM(self)
24913  *
24914  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
24915  * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
24916  * raise ValueError(u"ndarray is not C contiguous")
24917  */
24918  if (unlikely(__pyx_t_1)) {
24919 
24920  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":272
24921  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
24922  * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
24923  * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
24924  *
24925  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
24926  */
24927  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 272, __pyx_L1_error)
24928  __Pyx_GOTREF(__pyx_t_3);
24929  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
24930  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
24931  __PYX_ERR(1, 272, __pyx_L1_error)
24932 
24933  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":270
24934  * ndim = PyArray_NDIM(self)
24935  *
24936  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
24937  * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
24938  * raise ValueError(u"ndarray is not C contiguous")
24939  */
24940  }
24941 
24942  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":274
24943  * raise ValueError(u"ndarray is not C contiguous")
24944  *
24945  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
24946  * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
24947  * raise ValueError(u"ndarray is not Fortran contiguous")
24948  */
24949  __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
24950  if (__pyx_t_2) {
24951  } else {
24952  __pyx_t_1 = __pyx_t_2;
24953  goto __pyx_L7_bool_binop_done;
24954  }
24955 
24956  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":275
24957  *
24958  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
24959  * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): # <<<<<<<<<<<<<<
24960  * raise ValueError(u"ndarray is not Fortran contiguous")
24961  *
24962  */
24963  __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_F_CONTIGUOUS) != 0)) != 0);
24964  __pyx_t_1 = __pyx_t_2;
24965  __pyx_L7_bool_binop_done:;
24966 
24967  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":274
24968  * raise ValueError(u"ndarray is not C contiguous")
24969  *
24970  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
24971  * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
24972  * raise ValueError(u"ndarray is not Fortran contiguous")
24973  */
24974  if (unlikely(__pyx_t_1)) {
24975 
24976  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":276
24977  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
24978  * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
24979  * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
24980  *
24981  * info.buf = PyArray_DATA(self)
24982  */
24983  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 276, __pyx_L1_error)
24984  __Pyx_GOTREF(__pyx_t_3);
24985  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
24986  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
24987  __PYX_ERR(1, 276, __pyx_L1_error)
24988 
24989  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":274
24990  * raise ValueError(u"ndarray is not C contiguous")
24991  *
24992  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
24993  * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
24994  * raise ValueError(u"ndarray is not Fortran contiguous")
24995  */
24996  }
24997 
24998  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":278
24999  * raise ValueError(u"ndarray is not Fortran contiguous")
25000  *
25001  * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<<
25002  * info.ndim = ndim
25003  * if sizeof(npy_intp) != sizeof(Py_ssize_t):
25004  */
25005  __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);
25006 
25007  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":279
25008  *
25009  * info.buf = PyArray_DATA(self)
25010  * info.ndim = ndim # <<<<<<<<<<<<<<
25011  * if sizeof(npy_intp) != sizeof(Py_ssize_t):
25012  * # Allocate new buffer for strides and shape info.
25013  */
25014  __pyx_v_info->ndim = __pyx_v_ndim;
25015 
25016  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":280
25017  * info.buf = PyArray_DATA(self)
25018  * info.ndim = ndim
25019  * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
25020  * # Allocate new buffer for strides and shape info.
25021  * # This is allocated as one block, strides first.
25022  */
25023  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
25024  if (__pyx_t_1) {
25025 
25026  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":283
25027  * # Allocate new buffer for strides and shape info.
25028  * # This is allocated as one block, strides first.
25029  * info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim) # <<<<<<<<<<<<<<
25030  * info.shape = info.strides + ndim
25031  * for i in range(ndim):
25032  */
25033  __pyx_v_info->strides = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * 2) * ((size_t)__pyx_v_ndim))));
25034 
25035  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":284
25036  * # This is allocated as one block, strides first.
25037  * info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
25038  * info.shape = info.strides + ndim # <<<<<<<<<<<<<<
25039  * for i in range(ndim):
25040  * info.strides[i] = PyArray_STRIDES(self)[i]
25041  */
25042  __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);
25043 
25044  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":285
25045  * info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
25046  * info.shape = info.strides + ndim
25047  * for i in range(ndim): # <<<<<<<<<<<<<<
25048  * info.strides[i] = PyArray_STRIDES(self)[i]
25049  * info.shape[i] = PyArray_DIMS(self)[i]
25050  */
25051  __pyx_t_4 = __pyx_v_ndim;
25052  __pyx_t_5 = __pyx_t_4;
25053  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
25054  __pyx_v_i = __pyx_t_6;
25055 
25056  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":286
25057  * info.shape = info.strides + ndim
25058  * for i in range(ndim):
25059  * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<<
25060  * info.shape[i] = PyArray_DIMS(self)[i]
25061  * else:
25062  */
25063  (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);
25064 
25065  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":287
25066  * for i in range(ndim):
25067  * info.strides[i] = PyArray_STRIDES(self)[i]
25068  * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<<
25069  * else:
25070  * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
25071  */
25072  (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
25073  }
25074 
25075  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":280
25076  * info.buf = PyArray_DATA(self)
25077  * info.ndim = ndim
25078  * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
25079  * # Allocate new buffer for strides and shape info.
25080  * # This is allocated as one block, strides first.
25081  */
25082  goto __pyx_L9;
25083  }
25084 
25085  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":289
25086  * info.shape[i] = PyArray_DIMS(self)[i]
25087  * else:
25088  * info.strides = <Py_ssize_t*>PyArray_STRIDES(self) # <<<<<<<<<<<<<<
25089  * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
25090  * info.suboffsets = NULL
25091  */
25092  /*else*/ {
25093  __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));
25094 
25095  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":290
25096  * else:
25097  * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
25098  * info.shape = <Py_ssize_t*>PyArray_DIMS(self) # <<<<<<<<<<<<<<
25099  * info.suboffsets = NULL
25100  * info.itemsize = PyArray_ITEMSIZE(self)
25101  */
25102  __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
25103  }
25104  __pyx_L9:;
25105 
25106  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":291
25107  * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
25108  * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
25109  * info.suboffsets = NULL # <<<<<<<<<<<<<<
25110  * info.itemsize = PyArray_ITEMSIZE(self)
25111  * info.readonly = not PyArray_ISWRITEABLE(self)
25112  */
25113  __pyx_v_info->suboffsets = NULL;
25114 
25115  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":292
25116  * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
25117  * info.suboffsets = NULL
25118  * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<<
25119  * info.readonly = not PyArray_ISWRITEABLE(self)
25120  *
25121  */
25122  __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);
25123 
25124  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":293
25125  * info.suboffsets = NULL
25126  * info.itemsize = PyArray_ITEMSIZE(self)
25127  * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<<
25128  *
25129  * cdef int t
25130  */
25131  __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
25132 
25133  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":296
25134  *
25135  * cdef int t
25136  * cdef char* f = NULL # <<<<<<<<<<<<<<
25137  * cdef dtype descr = <dtype>PyArray_DESCR(self)
25138  * cdef int offset
25139  */
25140  __pyx_v_f = NULL;
25141 
25142  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":297
25143  * cdef int t
25144  * cdef char* f = NULL
25145  * cdef dtype descr = <dtype>PyArray_DESCR(self) # <<<<<<<<<<<<<<
25146  * cdef int offset
25147  *
25148  */
25149  __pyx_t_7 = PyArray_DESCR(__pyx_v_self);
25150  __pyx_t_3 = ((PyObject *)__pyx_t_7);
25151  __Pyx_INCREF(__pyx_t_3);
25152  __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
25153  __pyx_t_3 = 0;
25154 
25155  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":300
25156  * cdef int offset
25157  *
25158  * info.obj = self # <<<<<<<<<<<<<<
25159  *
25160  * if not PyDataType_HASFIELDS(descr):
25161  */
25162  __Pyx_INCREF(((PyObject *)__pyx_v_self));
25163  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
25164  __Pyx_GOTREF(__pyx_v_info->obj);
25165  __Pyx_DECREF(__pyx_v_info->obj);
25166  __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
25167 
25168  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":302
25169  * info.obj = self
25170  *
25171  * if not PyDataType_HASFIELDS(descr): # <<<<<<<<<<<<<<
25172  * t = descr.type_num
25173  * if ((descr.byteorder == c'>' and little_endian) or
25174  */
25175  __pyx_t_1 = ((!(PyDataType_HASFIELDS(__pyx_v_descr) != 0)) != 0);
25176  if (__pyx_t_1) {
25177 
25178  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":303
25179  *
25180  * if not PyDataType_HASFIELDS(descr):
25181  * t = descr.type_num # <<<<<<<<<<<<<<
25182  * if ((descr.byteorder == c'>' and little_endian) or
25183  * (descr.byteorder == c'<' and not little_endian)):
25184  */
25185  __pyx_t_4 = __pyx_v_descr->type_num;
25186  __pyx_v_t = __pyx_t_4;
25187 
25188  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":304
25189  * if not PyDataType_HASFIELDS(descr):
25190  * t = descr.type_num
25191  * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
25192  * (descr.byteorder == c'<' and not little_endian)):
25193  * raise ValueError(u"Non-native byte order not supported")
25194  */
25195  __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0);
25196  if (!__pyx_t_2) {
25197  goto __pyx_L15_next_or;
25198  } else {
25199  }
25200  __pyx_t_2 = (__pyx_v_little_endian != 0);
25201  if (!__pyx_t_2) {
25202  } else {
25203  __pyx_t_1 = __pyx_t_2;
25204  goto __pyx_L14_bool_binop_done;
25205  }
25206  __pyx_L15_next_or:;
25207 
25208  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":305
25209  * t = descr.type_num
25210  * if ((descr.byteorder == c'>' and little_endian) or
25211  * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
25212  * raise ValueError(u"Non-native byte order not supported")
25213  * if t == NPY_BYTE: f = "b"
25214  */
25215  __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0);
25216  if (__pyx_t_2) {
25217  } else {
25218  __pyx_t_1 = __pyx_t_2;
25219  goto __pyx_L14_bool_binop_done;
25220  }
25221  __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
25222  __pyx_t_1 = __pyx_t_2;
25223  __pyx_L14_bool_binop_done:;
25224 
25225  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":304
25226  * if not PyDataType_HASFIELDS(descr):
25227  * t = descr.type_num
25228  * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
25229  * (descr.byteorder == c'<' and not little_endian)):
25230  * raise ValueError(u"Non-native byte order not supported")
25231  */
25232  if (unlikely(__pyx_t_1)) {
25233 
25234  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":306
25235  * if ((descr.byteorder == c'>' and little_endian) or
25236  * (descr.byteorder == c'<' and not little_endian)):
25237  * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
25238  * if t == NPY_BYTE: f = "b"
25239  * elif t == NPY_UBYTE: f = "B"
25240  */
25241  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 306, __pyx_L1_error)
25242  __Pyx_GOTREF(__pyx_t_3);
25243  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
25244  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25245  __PYX_ERR(1, 306, __pyx_L1_error)
25246 
25247  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":304
25248  * if not PyDataType_HASFIELDS(descr):
25249  * t = descr.type_num
25250  * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
25251  * (descr.byteorder == c'<' and not little_endian)):
25252  * raise ValueError(u"Non-native byte order not supported")
25253  */
25254  }
25255 
25256  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":307
25257  * (descr.byteorder == c'<' and not little_endian)):
25258  * raise ValueError(u"Non-native byte order not supported")
25259  * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<<
25260  * elif t == NPY_UBYTE: f = "B"
25261  * elif t == NPY_SHORT: f = "h"
25262  */
25263  switch (__pyx_v_t) {
25264  case NPY_BYTE:
25265  __pyx_v_f = ((char *)"b");
25266  break;
25267  case NPY_UBYTE:
25268 
25269  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":308
25270  * raise ValueError(u"Non-native byte order not supported")
25271  * if t == NPY_BYTE: f = "b"
25272  * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<<
25273  * elif t == NPY_SHORT: f = "h"
25274  * elif t == NPY_USHORT: f = "H"
25275  */
25276  __pyx_v_f = ((char *)"B");
25277  break;
25278  case NPY_SHORT:
25279 
25280  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":309
25281  * if t == NPY_BYTE: f = "b"
25282  * elif t == NPY_UBYTE: f = "B"
25283  * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<<
25284  * elif t == NPY_USHORT: f = "H"
25285  * elif t == NPY_INT: f = "i"
25286  */
25287  __pyx_v_f = ((char *)"h");
25288  break;
25289  case NPY_USHORT:
25290 
25291  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":310
25292  * elif t == NPY_UBYTE: f = "B"
25293  * elif t == NPY_SHORT: f = "h"
25294  * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<<
25295  * elif t == NPY_INT: f = "i"
25296  * elif t == NPY_UINT: f = "I"
25297  */
25298  __pyx_v_f = ((char *)"H");
25299  break;
25300  case NPY_INT:
25301 
25302  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":311
25303  * elif t == NPY_SHORT: f = "h"
25304  * elif t == NPY_USHORT: f = "H"
25305  * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<<
25306  * elif t == NPY_UINT: f = "I"
25307  * elif t == NPY_LONG: f = "l"
25308  */
25309  __pyx_v_f = ((char *)"i");
25310  break;
25311  case NPY_UINT:
25312 
25313  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":312
25314  * elif t == NPY_USHORT: f = "H"
25315  * elif t == NPY_INT: f = "i"
25316  * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<<
25317  * elif t == NPY_LONG: f = "l"
25318  * elif t == NPY_ULONG: f = "L"
25319  */
25320  __pyx_v_f = ((char *)"I");
25321  break;
25322  case NPY_LONG:
25323 
25324  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":313
25325  * elif t == NPY_INT: f = "i"
25326  * elif t == NPY_UINT: f = "I"
25327  * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<<
25328  * elif t == NPY_ULONG: f = "L"
25329  * elif t == NPY_LONGLONG: f = "q"
25330  */
25331  __pyx_v_f = ((char *)"l");
25332  break;
25333  case NPY_ULONG:
25334 
25335  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":314
25336  * elif t == NPY_UINT: f = "I"
25337  * elif t == NPY_LONG: f = "l"
25338  * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<<
25339  * elif t == NPY_LONGLONG: f = "q"
25340  * elif t == NPY_ULONGLONG: f = "Q"
25341  */
25342  __pyx_v_f = ((char *)"L");
25343  break;
25344  case NPY_LONGLONG:
25345 
25346  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":315
25347  * elif t == NPY_LONG: f = "l"
25348  * elif t == NPY_ULONG: f = "L"
25349  * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<<
25350  * elif t == NPY_ULONGLONG: f = "Q"
25351  * elif t == NPY_FLOAT: f = "f"
25352  */
25353  __pyx_v_f = ((char *)"q");
25354  break;
25355  case NPY_ULONGLONG:
25356 
25357  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":316
25358  * elif t == NPY_ULONG: f = "L"
25359  * elif t == NPY_LONGLONG: f = "q"
25360  * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<<
25361  * elif t == NPY_FLOAT: f = "f"
25362  * elif t == NPY_DOUBLE: f = "d"
25363  */
25364  __pyx_v_f = ((char *)"Q");
25365  break;
25366  case NPY_FLOAT:
25367 
25368  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":317
25369  * elif t == NPY_LONGLONG: f = "q"
25370  * elif t == NPY_ULONGLONG: f = "Q"
25371  * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<<
25372  * elif t == NPY_DOUBLE: f = "d"
25373  * elif t == NPY_LONGDOUBLE: f = "g"
25374  */
25375  __pyx_v_f = ((char *)"f");
25376  break;
25377  case NPY_DOUBLE:
25378 
25379  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":318
25380  * elif t == NPY_ULONGLONG: f = "Q"
25381  * elif t == NPY_FLOAT: f = "f"
25382  * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<<
25383  * elif t == NPY_LONGDOUBLE: f = "g"
25384  * elif t == NPY_CFLOAT: f = "Zf"
25385  */
25386  __pyx_v_f = ((char *)"d");
25387  break;
25388  case NPY_LONGDOUBLE:
25389 
25390  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":319
25391  * elif t == NPY_FLOAT: f = "f"
25392  * elif t == NPY_DOUBLE: f = "d"
25393  * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<<
25394  * elif t == NPY_CFLOAT: f = "Zf"
25395  * elif t == NPY_CDOUBLE: f = "Zd"
25396  */
25397  __pyx_v_f = ((char *)"g");
25398  break;
25399  case NPY_CFLOAT:
25400 
25401  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":320
25402  * elif t == NPY_DOUBLE: f = "d"
25403  * elif t == NPY_LONGDOUBLE: f = "g"
25404  * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<<
25405  * elif t == NPY_CDOUBLE: f = "Zd"
25406  * elif t == NPY_CLONGDOUBLE: f = "Zg"
25407  */
25408  __pyx_v_f = ((char *)"Zf");
25409  break;
25410  case NPY_CDOUBLE:
25411 
25412  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":321
25413  * elif t == NPY_LONGDOUBLE: f = "g"
25414  * elif t == NPY_CFLOAT: f = "Zf"
25415  * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<<
25416  * elif t == NPY_CLONGDOUBLE: f = "Zg"
25417  * elif t == NPY_OBJECT: f = "O"
25418  */
25419  __pyx_v_f = ((char *)"Zd");
25420  break;
25421  case NPY_CLONGDOUBLE:
25422 
25423  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":322
25424  * elif t == NPY_CFLOAT: f = "Zf"
25425  * elif t == NPY_CDOUBLE: f = "Zd"
25426  * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<<
25427  * elif t == NPY_OBJECT: f = "O"
25428  * else:
25429  */
25430  __pyx_v_f = ((char *)"Zg");
25431  break;
25432  case NPY_OBJECT:
25433 
25434  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":323
25435  * elif t == NPY_CDOUBLE: f = "Zd"
25436  * elif t == NPY_CLONGDOUBLE: f = "Zg"
25437  * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<<
25438  * else:
25439  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
25440  */
25441  __pyx_v_f = ((char *)"O");
25442  break;
25443  default:
25444 
25445  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":325
25446  * elif t == NPY_OBJECT: f = "O"
25447  * else:
25448  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
25449  * info.format = f
25450  * return
25451  */
25452  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 325, __pyx_L1_error)
25453  __Pyx_GOTREF(__pyx_t_3);
25454  __pyx_t_8 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 325, __pyx_L1_error)
25455  __Pyx_GOTREF(__pyx_t_8);
25456  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25457  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 325, __pyx_L1_error)
25458  __Pyx_GOTREF(__pyx_t_3);
25459  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
25460  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
25461  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25462  __PYX_ERR(1, 325, __pyx_L1_error)
25463  break;
25464  }
25465 
25466  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":326
25467  * else:
25468  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
25469  * info.format = f # <<<<<<<<<<<<<<
25470  * return
25471  * else:
25472  */
25473  __pyx_v_info->format = __pyx_v_f;
25474 
25475  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":327
25476  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
25477  * info.format = f
25478  * return # <<<<<<<<<<<<<<
25479  * else:
25480  * info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
25481  */
25482  __pyx_r = 0;
25483  goto __pyx_L0;
25484 
25485  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":302
25486  * info.obj = self
25487  *
25488  * if not PyDataType_HASFIELDS(descr): # <<<<<<<<<<<<<<
25489  * t = descr.type_num
25490  * if ((descr.byteorder == c'>' and little_endian) or
25491  */
25492  }
25493 
25494  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":329
25495  * return
25496  * else:
25497  * info.format = <char*>PyObject_Malloc(_buffer_format_string_len) # <<<<<<<<<<<<<<
25498  * info.format[0] = c'^' # Native data types, manual alignment
25499  * offset = 0
25500  */
25501  /*else*/ {
25502  __pyx_v_info->format = ((char *)PyObject_Malloc(0xFF));
25503 
25504  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":330
25505  * else:
25506  * info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
25507  * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<<
25508  * offset = 0
25509  * f = _util_dtypestring(descr, info.format + 1,
25510  */
25511  (__pyx_v_info->format[0]) = '^';
25512 
25513  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":331
25514  * info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
25515  * info.format[0] = c'^' # Native data types, manual alignment
25516  * offset = 0 # <<<<<<<<<<<<<<
25517  * f = _util_dtypestring(descr, info.format + 1,
25518  * info.format + _buffer_format_string_len,
25519  */
25520  __pyx_v_offset = 0;
25521 
25522  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":332
25523  * info.format[0] = c'^' # Native data types, manual alignment
25524  * offset = 0
25525  * f = _util_dtypestring(descr, info.format + 1, # <<<<<<<<<<<<<<
25526  * info.format + _buffer_format_string_len,
25527  * &offset)
25528  */
25529  __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 332, __pyx_L1_error)
25530  __pyx_v_f = __pyx_t_9;
25531 
25532  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":335
25533  * info.format + _buffer_format_string_len,
25534  * &offset)
25535  * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<<
25536  *
25537  * def __releasebuffer__(ndarray self, Py_buffer* info):
25538  */
25539  (__pyx_v_f[0]) = '\x00';
25540  }
25541 
25542  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":258
25543  * # experimental exception made for __getbuffer__ and __releasebuffer__
25544  * # -- the details of this may change.
25545  * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
25546  * # This implementation of getbuffer is geared towards Cython
25547  * # requirements, and does not yet fulfill the PEP.
25548  */
25549 
25550  /* function exit code */
25551  __pyx_r = 0;
25552  goto __pyx_L0;
25553  __pyx_L1_error:;
25554  __Pyx_XDECREF(__pyx_t_3);
25555  __Pyx_XDECREF(__pyx_t_8);
25556  __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
25557  __pyx_r = -1;
25558  if (__pyx_v_info->obj != NULL) {
25559  __Pyx_GOTREF(__pyx_v_info->obj);
25560  __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
25561  }
25562  goto __pyx_L2;
25563  __pyx_L0:;
25564  if (__pyx_v_info->obj == Py_None) {
25565  __Pyx_GOTREF(__pyx_v_info->obj);
25566  __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
25567  }
25568  __pyx_L2:;
25569  __Pyx_XDECREF((PyObject *)__pyx_v_descr);
25570  __Pyx_RefNannyFinishContext();
25571  return __pyx_r;
25572 }
25573 
25574 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":337
25575  * f[0] = c'\0' # Terminate format string
25576  *
25577  * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
25578  * if PyArray_HASFIELDS(self):
25579  * PyObject_Free(info.format)
25580  */
25581 
25582 /* Python wrapper */
25583 static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
25584 static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
25585  __Pyx_RefNannyDeclarations
25586  __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
25587  __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
25588 
25589  /* function exit code */
25590  __Pyx_RefNannyFinishContext();
25591 }
25592 
25593 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
25594  __Pyx_RefNannyDeclarations
25595  int __pyx_t_1;
25596  __Pyx_RefNannySetupContext("__releasebuffer__", 0);
25597 
25598  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":338
25599  *
25600  * def __releasebuffer__(ndarray self, Py_buffer* info):
25601  * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
25602  * PyObject_Free(info.format)
25603  * if sizeof(npy_intp) != sizeof(Py_ssize_t):
25604  */
25605  __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
25606  if (__pyx_t_1) {
25607 
25608  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":339
25609  * def __releasebuffer__(ndarray self, Py_buffer* info):
25610  * if PyArray_HASFIELDS(self):
25611  * PyObject_Free(info.format) # <<<<<<<<<<<<<<
25612  * if sizeof(npy_intp) != sizeof(Py_ssize_t):
25613  * PyObject_Free(info.strides)
25614  */
25615  PyObject_Free(__pyx_v_info->format);
25616 
25617  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":338
25618  *
25619  * def __releasebuffer__(ndarray self, Py_buffer* info):
25620  * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
25621  * PyObject_Free(info.format)
25622  * if sizeof(npy_intp) != sizeof(Py_ssize_t):
25623  */
25624  }
25625 
25626  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":340
25627  * if PyArray_HASFIELDS(self):
25628  * PyObject_Free(info.format)
25629  * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
25630  * PyObject_Free(info.strides)
25631  * # info.shape was stored after info.strides in the same block
25632  */
25633  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
25634  if (__pyx_t_1) {
25635 
25636  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":341
25637  * PyObject_Free(info.format)
25638  * if sizeof(npy_intp) != sizeof(Py_ssize_t):
25639  * PyObject_Free(info.strides) # <<<<<<<<<<<<<<
25640  * # info.shape was stored after info.strides in the same block
25641  *
25642  */
25643  PyObject_Free(__pyx_v_info->strides);
25644 
25645  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":340
25646  * if PyArray_HASFIELDS(self):
25647  * PyObject_Free(info.format)
25648  * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
25649  * PyObject_Free(info.strides)
25650  * # info.shape was stored after info.strides in the same block
25651  */
25652  }
25653 
25654  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":337
25655  * f[0] = c'\0' # Terminate format string
25656  *
25657  * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
25658  * if PyArray_HASFIELDS(self):
25659  * PyObject_Free(info.format)
25660  */
25661 
25662  /* function exit code */
25663  __Pyx_RefNannyFinishContext();
25664 }
25665 
25666 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":821
25667  * ctypedef npy_cdouble complex_t
25668  *
25669  * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
25670  * return PyArray_MultiIterNew(1, <void*>a)
25671  *
25672  */
25673 
25674 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
25675  PyObject *__pyx_r = NULL;
25676  __Pyx_RefNannyDeclarations
25677  PyObject *__pyx_t_1 = NULL;
25678  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
25679 
25680  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":822
25681  *
25682  * cdef inline object PyArray_MultiIterNew1(a):
25683  * return PyArray_MultiIterNew(1, <void*>a) # <<<<<<<<<<<<<<
25684  *
25685  * cdef inline object PyArray_MultiIterNew2(a, b):
25686  */
25687  __Pyx_XDECREF(__pyx_r);
25688  __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 822, __pyx_L1_error)
25689  __Pyx_GOTREF(__pyx_t_1);
25690  __pyx_r = __pyx_t_1;
25691  __pyx_t_1 = 0;
25692  goto __pyx_L0;
25693 
25694  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":821
25695  * ctypedef npy_cdouble complex_t
25696  *
25697  * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
25698  * return PyArray_MultiIterNew(1, <void*>a)
25699  *
25700  */
25701 
25702  /* function exit code */
25703  __pyx_L1_error:;
25704  __Pyx_XDECREF(__pyx_t_1);
25705  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
25706  __pyx_r = 0;
25707  __pyx_L0:;
25708  __Pyx_XGIVEREF(__pyx_r);
25709  __Pyx_RefNannyFinishContext();
25710  return __pyx_r;
25711 }
25712 
25713 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":824
25714  * return PyArray_MultiIterNew(1, <void*>a)
25715  *
25716  * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
25717  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
25718  *
25719  */
25720 
25721 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
25722  PyObject *__pyx_r = NULL;
25723  __Pyx_RefNannyDeclarations
25724  PyObject *__pyx_t_1 = NULL;
25725  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
25726 
25727  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":825
25728  *
25729  * cdef inline object PyArray_MultiIterNew2(a, b):
25730  * return PyArray_MultiIterNew(2, <void*>a, <void*>b) # <<<<<<<<<<<<<<
25731  *
25732  * cdef inline object PyArray_MultiIterNew3(a, b, c):
25733  */
25734  __Pyx_XDECREF(__pyx_r);
25735  __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 825, __pyx_L1_error)
25736  __Pyx_GOTREF(__pyx_t_1);
25737  __pyx_r = __pyx_t_1;
25738  __pyx_t_1 = 0;
25739  goto __pyx_L0;
25740 
25741  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":824
25742  * return PyArray_MultiIterNew(1, <void*>a)
25743  *
25744  * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
25745  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
25746  *
25747  */
25748 
25749  /* function exit code */
25750  __pyx_L1_error:;
25751  __Pyx_XDECREF(__pyx_t_1);
25752  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
25753  __pyx_r = 0;
25754  __pyx_L0:;
25755  __Pyx_XGIVEREF(__pyx_r);
25756  __Pyx_RefNannyFinishContext();
25757  return __pyx_r;
25758 }
25759 
25760 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":827
25761  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
25762  *
25763  * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
25764  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
25765  *
25766  */
25767 
25768 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
25769  PyObject *__pyx_r = NULL;
25770  __Pyx_RefNannyDeclarations
25771  PyObject *__pyx_t_1 = NULL;
25772  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
25773 
25774  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":828
25775  *
25776  * cdef inline object PyArray_MultiIterNew3(a, b, c):
25777  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) # <<<<<<<<<<<<<<
25778  *
25779  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
25780  */
25781  __Pyx_XDECREF(__pyx_r);
25782  __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 828, __pyx_L1_error)
25783  __Pyx_GOTREF(__pyx_t_1);
25784  __pyx_r = __pyx_t_1;
25785  __pyx_t_1 = 0;
25786  goto __pyx_L0;
25787 
25788  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":827
25789  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
25790  *
25791  * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
25792  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
25793  *
25794  */
25795 
25796  /* function exit code */
25797  __pyx_L1_error:;
25798  __Pyx_XDECREF(__pyx_t_1);
25799  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
25800  __pyx_r = 0;
25801  __pyx_L0:;
25802  __Pyx_XGIVEREF(__pyx_r);
25803  __Pyx_RefNannyFinishContext();
25804  return __pyx_r;
25805 }
25806 
25807 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":830
25808  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
25809  *
25810  * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
25811  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
25812  *
25813  */
25814 
25815 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
25816  PyObject *__pyx_r = NULL;
25817  __Pyx_RefNannyDeclarations
25818  PyObject *__pyx_t_1 = NULL;
25819  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
25820 
25821  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":831
25822  *
25823  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
25824  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) # <<<<<<<<<<<<<<
25825  *
25826  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
25827  */
25828  __Pyx_XDECREF(__pyx_r);
25829  __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 831, __pyx_L1_error)
25830  __Pyx_GOTREF(__pyx_t_1);
25831  __pyx_r = __pyx_t_1;
25832  __pyx_t_1 = 0;
25833  goto __pyx_L0;
25834 
25835  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":830
25836  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
25837  *
25838  * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
25839  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
25840  *
25841  */
25842 
25843  /* function exit code */
25844  __pyx_L1_error:;
25845  __Pyx_XDECREF(__pyx_t_1);
25846  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
25847  __pyx_r = 0;
25848  __pyx_L0:;
25849  __Pyx_XGIVEREF(__pyx_r);
25850  __Pyx_RefNannyFinishContext();
25851  return __pyx_r;
25852 }
25853 
25854 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":833
25855  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
25856  *
25857  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
25858  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
25859  *
25860  */
25861 
25862 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
25863  PyObject *__pyx_r = NULL;
25864  __Pyx_RefNannyDeclarations
25865  PyObject *__pyx_t_1 = NULL;
25866  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
25867 
25868  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":834
25869  *
25870  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
25871  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) # <<<<<<<<<<<<<<
25872  *
25873  * cdef inline tuple PyDataType_SHAPE(dtype d):
25874  */
25875  __Pyx_XDECREF(__pyx_r);
25876  __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 834, __pyx_L1_error)
25877  __Pyx_GOTREF(__pyx_t_1);
25878  __pyx_r = __pyx_t_1;
25879  __pyx_t_1 = 0;
25880  goto __pyx_L0;
25881 
25882  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":833
25883  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
25884  *
25885  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
25886  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
25887  *
25888  */
25889 
25890  /* function exit code */
25891  __pyx_L1_error:;
25892  __Pyx_XDECREF(__pyx_t_1);
25893  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
25894  __pyx_r = 0;
25895  __pyx_L0:;
25896  __Pyx_XGIVEREF(__pyx_r);
25897  __Pyx_RefNannyFinishContext();
25898  return __pyx_r;
25899 }
25900 
25901 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":836
25902  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
25903  *
25904  * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
25905  * if PyDataType_HASSUBARRAY(d):
25906  * return <tuple>d.subarray.shape
25907  */
25908 
25909 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
25910  PyObject *__pyx_r = NULL;
25911  __Pyx_RefNannyDeclarations
25912  int __pyx_t_1;
25913  __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
25914 
25915  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":837
25916  *
25917  * cdef inline tuple PyDataType_SHAPE(dtype d):
25918  * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
25919  * return <tuple>d.subarray.shape
25920  * else:
25921  */
25922  __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
25923  if (__pyx_t_1) {
25924 
25925  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":838
25926  * cdef inline tuple PyDataType_SHAPE(dtype d):
25927  * if PyDataType_HASSUBARRAY(d):
25928  * return <tuple>d.subarray.shape # <<<<<<<<<<<<<<
25929  * else:
25930  * return ()
25931  */
25932  __Pyx_XDECREF(__pyx_r);
25933  __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
25934  __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
25935  goto __pyx_L0;
25936 
25937  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":837
25938  *
25939  * cdef inline tuple PyDataType_SHAPE(dtype d):
25940  * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
25941  * return <tuple>d.subarray.shape
25942  * else:
25943  */
25944  }
25945 
25946  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":840
25947  * return <tuple>d.subarray.shape
25948  * else:
25949  * return () # <<<<<<<<<<<<<<
25950  *
25951  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
25952  */
25953  /*else*/ {
25954  __Pyx_XDECREF(__pyx_r);
25955  __Pyx_INCREF(__pyx_empty_tuple);
25956  __pyx_r = __pyx_empty_tuple;
25957  goto __pyx_L0;
25958  }
25959 
25960  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":836
25961  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
25962  *
25963  * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
25964  * if PyDataType_HASSUBARRAY(d):
25965  * return <tuple>d.subarray.shape
25966  */
25967 
25968  /* function exit code */
25969  __pyx_L0:;
25970  __Pyx_XGIVEREF(__pyx_r);
25971  __Pyx_RefNannyFinishContext();
25972  return __pyx_r;
25973 }
25974 
25975 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":842
25976  * return ()
25977  *
25978  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
25979  * # Recursive utility function used in __getbuffer__ to get format
25980  * # string. The new location in the format string is returned.
25981  */
25982 
25983 static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) {
25984  PyArray_Descr *__pyx_v_child = 0;
25985  int __pyx_v_endian_detector;
25986  int __pyx_v_little_endian;
25987  PyObject *__pyx_v_fields = 0;
25988  PyObject *__pyx_v_childname = NULL;
25989  PyObject *__pyx_v_new_offset = NULL;
25990  PyObject *__pyx_v_t = NULL;
25991  char *__pyx_r;
25992  __Pyx_RefNannyDeclarations
25993  PyObject *__pyx_t_1 = NULL;
25994  Py_ssize_t __pyx_t_2;
25995  PyObject *__pyx_t_3 = NULL;
25996  PyObject *__pyx_t_4 = NULL;
25997  int __pyx_t_5;
25998  int __pyx_t_6;
25999  int __pyx_t_7;
26000  long __pyx_t_8;
26001  char *__pyx_t_9;
26002  __Pyx_RefNannySetupContext("_util_dtypestring", 0);
26003 
26004  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":847
26005  *
26006  * cdef dtype child
26007  * cdef int endian_detector = 1 # <<<<<<<<<<<<<<
26008  * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
26009  * cdef tuple fields
26010  */
26011  __pyx_v_endian_detector = 1;
26012 
26013  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":848
26014  * cdef dtype child
26015  * cdef int endian_detector = 1
26016  * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
26017  * cdef tuple fields
26018  *
26019  */
26020  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
26021 
26022  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":851
26023  * cdef tuple fields
26024  *
26025  * for childname in descr.names: # <<<<<<<<<<<<<<
26026  * fields = descr.fields[childname]
26027  * child, new_offset = fields
26028  */
26029  if (unlikely(__pyx_v_descr->names == Py_None)) {
26030  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
26031  __PYX_ERR(1, 851, __pyx_L1_error)
26032  }
26033  __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
26034  for (;;) {
26035  if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
26036  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
26037  __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 851, __pyx_L1_error)
26038  #else
26039  __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 851, __pyx_L1_error)
26040  __Pyx_GOTREF(__pyx_t_3);
26041  #endif
26042  __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
26043  __pyx_t_3 = 0;
26044 
26045  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":852
26046  *
26047  * for childname in descr.names:
26048  * fields = descr.fields[childname] # <<<<<<<<<<<<<<
26049  * child, new_offset = fields
26050  *
26051  */
26052  if (unlikely(__pyx_v_descr->fields == Py_None)) {
26053  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
26054  __PYX_ERR(1, 852, __pyx_L1_error)
26055  }
26056  __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 852, __pyx_L1_error)
26057  __Pyx_GOTREF(__pyx_t_3);
26058  if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(1, 852, __pyx_L1_error)
26059  __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
26060  __pyx_t_3 = 0;
26061 
26062  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":853
26063  * for childname in descr.names:
26064  * fields = descr.fields[childname]
26065  * child, new_offset = fields # <<<<<<<<<<<<<<
26066  *
26067  * if (end - f) - <int>(new_offset - offset[0]) < 15:
26068  */
26069  if (likely(__pyx_v_fields != Py_None)) {
26070  PyObject* sequence = __pyx_v_fields;
26071  Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
26072  if (unlikely(size != 2)) {
26073  if (size > 2) __Pyx_RaiseTooManyValuesError(2);
26074  else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
26075  __PYX_ERR(1, 853, __pyx_L1_error)
26076  }
26077  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
26078  __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
26079  __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
26080  __Pyx_INCREF(__pyx_t_3);
26081  __Pyx_INCREF(__pyx_t_4);
26082  #else
26083  __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 853, __pyx_L1_error)
26084  __Pyx_GOTREF(__pyx_t_3);
26085  __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 853, __pyx_L1_error)
26086  __Pyx_GOTREF(__pyx_t_4);
26087  #endif
26088  } else {
26089  __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 853, __pyx_L1_error)
26090  }
26091  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(1, 853, __pyx_L1_error)
26092  __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
26093  __pyx_t_3 = 0;
26094  __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
26095  __pyx_t_4 = 0;
26096 
26097  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":855
26098  * child, new_offset = fields
26099  *
26100  * if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
26101  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
26102  *
26103  */
26104  __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 855, __pyx_L1_error)
26105  __Pyx_GOTREF(__pyx_t_4);
26106  __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 855, __pyx_L1_error)
26107  __Pyx_GOTREF(__pyx_t_3);
26108  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26109  __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 855, __pyx_L1_error)
26110  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26111  __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0);
26112  if (unlikely(__pyx_t_6)) {
26113 
26114  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":856
26115  *
26116  * if (end - f) - <int>(new_offset - offset[0]) < 15:
26117  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
26118  *
26119  * if ((child.byteorder == c'>' and little_endian) or
26120  */
26121  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 856, __pyx_L1_error)
26122  __Pyx_GOTREF(__pyx_t_3);
26123  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
26124  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26125  __PYX_ERR(1, 856, __pyx_L1_error)
26126 
26127  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":855
26128  * child, new_offset = fields
26129  *
26130  * if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
26131  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
26132  *
26133  */
26134  }
26135 
26136  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":858
26137  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
26138  *
26139  * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
26140  * (child.byteorder == c'<' and not little_endian)):
26141  * raise ValueError(u"Non-native byte order not supported")
26142  */
26143  __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
26144  if (!__pyx_t_7) {
26145  goto __pyx_L8_next_or;
26146  } else {
26147  }
26148  __pyx_t_7 = (__pyx_v_little_endian != 0);
26149  if (!__pyx_t_7) {
26150  } else {
26151  __pyx_t_6 = __pyx_t_7;
26152  goto __pyx_L7_bool_binop_done;
26153  }
26154  __pyx_L8_next_or:;
26155 
26156  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":859
26157  *
26158  * if ((child.byteorder == c'>' and little_endian) or
26159  * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
26160  * raise ValueError(u"Non-native byte order not supported")
26161  * # One could encode it in the format string and have Cython
26162  */
26163  __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
26164  if (__pyx_t_7) {
26165  } else {
26166  __pyx_t_6 = __pyx_t_7;
26167  goto __pyx_L7_bool_binop_done;
26168  }
26169  __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
26170  __pyx_t_6 = __pyx_t_7;
26171  __pyx_L7_bool_binop_done:;
26172 
26173  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":858
26174  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
26175  *
26176  * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
26177  * (child.byteorder == c'<' and not little_endian)):
26178  * raise ValueError(u"Non-native byte order not supported")
26179  */
26180  if (unlikely(__pyx_t_6)) {
26181 
26182  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":860
26183  * if ((child.byteorder == c'>' and little_endian) or
26184  * (child.byteorder == c'<' and not little_endian)):
26185  * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
26186  * # One could encode it in the format string and have Cython
26187  * # complain instead, BUT: < and > in format strings also imply
26188  */
26189  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 860, __pyx_L1_error)
26190  __Pyx_GOTREF(__pyx_t_3);
26191  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
26192  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26193  __PYX_ERR(1, 860, __pyx_L1_error)
26194 
26195  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":858
26196  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
26197  *
26198  * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
26199  * (child.byteorder == c'<' and not little_endian)):
26200  * raise ValueError(u"Non-native byte order not supported")
26201  */
26202  }
26203 
26204  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":870
26205  *
26206  * # Output padding bytes
26207  * while offset[0] < new_offset: # <<<<<<<<<<<<<<
26208  * f[0] = 120 # "x"; pad byte
26209  * f += 1
26210  */
26211  while (1) {
26212  __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 870, __pyx_L1_error)
26213  __Pyx_GOTREF(__pyx_t_3);
26214  __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 870, __pyx_L1_error)
26215  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26216  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 870, __pyx_L1_error)
26217  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26218  if (!__pyx_t_6) break;
26219 
26220  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":871
26221  * # Output padding bytes
26222  * while offset[0] < new_offset:
26223  * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<<
26224  * f += 1
26225  * offset[0] += 1
26226  */
26227  (__pyx_v_f[0]) = 0x78;
26228 
26229  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":872
26230  * while offset[0] < new_offset:
26231  * f[0] = 120 # "x"; pad byte
26232  * f += 1 # <<<<<<<<<<<<<<
26233  * offset[0] += 1
26234  *
26235  */
26236  __pyx_v_f = (__pyx_v_f + 1);
26237 
26238  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":873
26239  * f[0] = 120 # "x"; pad byte
26240  * f += 1
26241  * offset[0] += 1 # <<<<<<<<<<<<<<
26242  *
26243  * offset[0] += child.itemsize
26244  */
26245  __pyx_t_8 = 0;
26246  (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
26247  }
26248 
26249  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":875
26250  * offset[0] += 1
26251  *
26252  * offset[0] += child.itemsize # <<<<<<<<<<<<<<
26253  *
26254  * if not PyDataType_HASFIELDS(child):
26255  */
26256  __pyx_t_8 = 0;
26257  (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);
26258 
26259  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":877
26260  * offset[0] += child.itemsize
26261  *
26262  * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
26263  * t = child.type_num
26264  * if end - f < 5:
26265  */
26266  __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
26267  if (__pyx_t_6) {
26268 
26269  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":878
26270  *
26271  * if not PyDataType_HASFIELDS(child):
26272  * t = child.type_num # <<<<<<<<<<<<<<
26273  * if end - f < 5:
26274  * raise RuntimeError(u"Format string allocated too short.")
26275  */
26276  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 878, __pyx_L1_error)
26277  __Pyx_GOTREF(__pyx_t_4);
26278  __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
26279  __pyx_t_4 = 0;
26280 
26281  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":879
26282  * if not PyDataType_HASFIELDS(child):
26283  * t = child.type_num
26284  * if end - f < 5: # <<<<<<<<<<<<<<
26285  * raise RuntimeError(u"Format string allocated too short.")
26286  *
26287  */
26288  __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
26289  if (unlikely(__pyx_t_6)) {
26290 
26291  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":880
26292  * t = child.type_num
26293  * if end - f < 5:
26294  * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
26295  *
26296  * # Until ticket #99 is fixed, use integers to avoid warnings
26297  */
26298  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 880, __pyx_L1_error)
26299  __Pyx_GOTREF(__pyx_t_4);
26300  __Pyx_Raise(__pyx_t_4, 0, 0, 0);
26301  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26302  __PYX_ERR(1, 880, __pyx_L1_error)
26303 
26304  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":879
26305  * if not PyDataType_HASFIELDS(child):
26306  * t = child.type_num
26307  * if end - f < 5: # <<<<<<<<<<<<<<
26308  * raise RuntimeError(u"Format string allocated too short.")
26309  *
26310  */
26311  }
26312 
26313  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":883
26314  *
26315  * # Until ticket #99 is fixed, use integers to avoid warnings
26316  * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<<
26317  * elif t == NPY_UBYTE: f[0] = 66 #"B"
26318  * elif t == NPY_SHORT: f[0] = 104 #"h"
26319  */
26320  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 883, __pyx_L1_error)
26321  __Pyx_GOTREF(__pyx_t_4);
26322  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 883, __pyx_L1_error)
26323  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26324  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 883, __pyx_L1_error)
26325  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26326  if (__pyx_t_6) {
26327  (__pyx_v_f[0]) = 98;
26328  goto __pyx_L15;
26329  }
26330 
26331  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":884
26332  * # Until ticket #99 is fixed, use integers to avoid warnings
26333  * if t == NPY_BYTE: f[0] = 98 #"b"
26334  * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<<
26335  * elif t == NPY_SHORT: f[0] = 104 #"h"
26336  * elif t == NPY_USHORT: f[0] = 72 #"H"
26337  */
26338  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 884, __pyx_L1_error)
26339  __Pyx_GOTREF(__pyx_t_3);
26340  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 884, __pyx_L1_error)
26341  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26342  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 884, __pyx_L1_error)
26343  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26344  if (__pyx_t_6) {
26345  (__pyx_v_f[0]) = 66;
26346  goto __pyx_L15;
26347  }
26348 
26349  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":885
26350  * if t == NPY_BYTE: f[0] = 98 #"b"
26351  * elif t == NPY_UBYTE: f[0] = 66 #"B"
26352  * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<<
26353  * elif t == NPY_USHORT: f[0] = 72 #"H"
26354  * elif t == NPY_INT: f[0] = 105 #"i"
26355  */
26356  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 885, __pyx_L1_error)
26357  __Pyx_GOTREF(__pyx_t_4);
26358  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 885, __pyx_L1_error)
26359  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26360  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 885, __pyx_L1_error)
26361  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26362  if (__pyx_t_6) {
26363  (__pyx_v_f[0]) = 0x68;
26364  goto __pyx_L15;
26365  }
26366 
26367  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":886
26368  * elif t == NPY_UBYTE: f[0] = 66 #"B"
26369  * elif t == NPY_SHORT: f[0] = 104 #"h"
26370  * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<<
26371  * elif t == NPY_INT: f[0] = 105 #"i"
26372  * elif t == NPY_UINT: f[0] = 73 #"I"
26373  */
26374  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 886, __pyx_L1_error)
26375  __Pyx_GOTREF(__pyx_t_3);
26376  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 886, __pyx_L1_error)
26377  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26378  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 886, __pyx_L1_error)
26379  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26380  if (__pyx_t_6) {
26381  (__pyx_v_f[0]) = 72;
26382  goto __pyx_L15;
26383  }
26384 
26385  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":887
26386  * elif t == NPY_SHORT: f[0] = 104 #"h"
26387  * elif t == NPY_USHORT: f[0] = 72 #"H"
26388  * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<<
26389  * elif t == NPY_UINT: f[0] = 73 #"I"
26390  * elif t == NPY_LONG: f[0] = 108 #"l"
26391  */
26392  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 887, __pyx_L1_error)
26393  __Pyx_GOTREF(__pyx_t_4);
26394  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 887, __pyx_L1_error)
26395  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26396  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 887, __pyx_L1_error)
26397  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26398  if (__pyx_t_6) {
26399  (__pyx_v_f[0]) = 0x69;
26400  goto __pyx_L15;
26401  }
26402 
26403  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":888
26404  * elif t == NPY_USHORT: f[0] = 72 #"H"
26405  * elif t == NPY_INT: f[0] = 105 #"i"
26406  * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<<
26407  * elif t == NPY_LONG: f[0] = 108 #"l"
26408  * elif t == NPY_ULONG: f[0] = 76 #"L"
26409  */
26410  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 888, __pyx_L1_error)
26411  __Pyx_GOTREF(__pyx_t_3);
26412  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 888, __pyx_L1_error)
26413  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26414  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 888, __pyx_L1_error)
26415  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26416  if (__pyx_t_6) {
26417  (__pyx_v_f[0]) = 73;
26418  goto __pyx_L15;
26419  }
26420 
26421  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":889
26422  * elif t == NPY_INT: f[0] = 105 #"i"
26423  * elif t == NPY_UINT: f[0] = 73 #"I"
26424  * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<<
26425  * elif t == NPY_ULONG: f[0] = 76 #"L"
26426  * elif t == NPY_LONGLONG: f[0] = 113 #"q"
26427  */
26428  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 889, __pyx_L1_error)
26429  __Pyx_GOTREF(__pyx_t_4);
26430  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 889, __pyx_L1_error)
26431  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26432  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 889, __pyx_L1_error)
26433  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26434  if (__pyx_t_6) {
26435  (__pyx_v_f[0]) = 0x6C;
26436  goto __pyx_L15;
26437  }
26438 
26439  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":890
26440  * elif t == NPY_UINT: f[0] = 73 #"I"
26441  * elif t == NPY_LONG: f[0] = 108 #"l"
26442  * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<<
26443  * elif t == NPY_LONGLONG: f[0] = 113 #"q"
26444  * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
26445  */
26446  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 890, __pyx_L1_error)
26447  __Pyx_GOTREF(__pyx_t_3);
26448  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 890, __pyx_L1_error)
26449  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26450  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 890, __pyx_L1_error)
26451  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26452  if (__pyx_t_6) {
26453  (__pyx_v_f[0]) = 76;
26454  goto __pyx_L15;
26455  }
26456 
26457  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":891
26458  * elif t == NPY_LONG: f[0] = 108 #"l"
26459  * elif t == NPY_ULONG: f[0] = 76 #"L"
26460  * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<<
26461  * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
26462  * elif t == NPY_FLOAT: f[0] = 102 #"f"
26463  */
26464  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 891, __pyx_L1_error)
26465  __Pyx_GOTREF(__pyx_t_4);
26466  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 891, __pyx_L1_error)
26467  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26468  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 891, __pyx_L1_error)
26469  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26470  if (__pyx_t_6) {
26471  (__pyx_v_f[0]) = 0x71;
26472  goto __pyx_L15;
26473  }
26474 
26475  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":892
26476  * elif t == NPY_ULONG: f[0] = 76 #"L"
26477  * elif t == NPY_LONGLONG: f[0] = 113 #"q"
26478  * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<<
26479  * elif t == NPY_FLOAT: f[0] = 102 #"f"
26480  * elif t == NPY_DOUBLE: f[0] = 100 #"d"
26481  */
26482  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 892, __pyx_L1_error)
26483  __Pyx_GOTREF(__pyx_t_3);
26484  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 892, __pyx_L1_error)
26485  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26486  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 892, __pyx_L1_error)
26487  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26488  if (__pyx_t_6) {
26489  (__pyx_v_f[0]) = 81;
26490  goto __pyx_L15;
26491  }
26492 
26493  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":893
26494  * elif t == NPY_LONGLONG: f[0] = 113 #"q"
26495  * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
26496  * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<<
26497  * elif t == NPY_DOUBLE: f[0] = 100 #"d"
26498  * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
26499  */
26500  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 893, __pyx_L1_error)
26501  __Pyx_GOTREF(__pyx_t_4);
26502  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 893, __pyx_L1_error)
26503  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26504  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 893, __pyx_L1_error)
26505  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26506  if (__pyx_t_6) {
26507  (__pyx_v_f[0]) = 0x66;
26508  goto __pyx_L15;
26509  }
26510 
26511  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":894
26512  * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
26513  * elif t == NPY_FLOAT: f[0] = 102 #"f"
26514  * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<<
26515  * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
26516  * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
26517  */
26518  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 894, __pyx_L1_error)
26519  __Pyx_GOTREF(__pyx_t_3);
26520  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 894, __pyx_L1_error)
26521  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26522  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 894, __pyx_L1_error)
26523  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26524  if (__pyx_t_6) {
26525  (__pyx_v_f[0]) = 0x64;
26526  goto __pyx_L15;
26527  }
26528 
26529  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":895
26530  * elif t == NPY_FLOAT: f[0] = 102 #"f"
26531  * elif t == NPY_DOUBLE: f[0] = 100 #"d"
26532  * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<<
26533  * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
26534  * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
26535  */
26536  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 895, __pyx_L1_error)
26537  __Pyx_GOTREF(__pyx_t_4);
26538  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 895, __pyx_L1_error)
26539  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26540  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 895, __pyx_L1_error)
26541  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26542  if (__pyx_t_6) {
26543  (__pyx_v_f[0]) = 0x67;
26544  goto __pyx_L15;
26545  }
26546 
26547  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":896
26548  * elif t == NPY_DOUBLE: f[0] = 100 #"d"
26549  * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
26550  * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<<
26551  * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
26552  * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
26553  */
26554  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 896, __pyx_L1_error)
26555  __Pyx_GOTREF(__pyx_t_3);
26556  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 896, __pyx_L1_error)
26557  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26558  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 896, __pyx_L1_error)
26559  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26560  if (__pyx_t_6) {
26561  (__pyx_v_f[0]) = 90;
26562  (__pyx_v_f[1]) = 0x66;
26563  __pyx_v_f = (__pyx_v_f + 1);
26564  goto __pyx_L15;
26565  }
26566 
26567  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":897
26568  * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
26569  * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
26570  * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<<
26571  * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
26572  * elif t == NPY_OBJECT: f[0] = 79 #"O"
26573  */
26574  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 897, __pyx_L1_error)
26575  __Pyx_GOTREF(__pyx_t_4);
26576  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 897, __pyx_L1_error)
26577  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26578  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 897, __pyx_L1_error)
26579  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26580  if (__pyx_t_6) {
26581  (__pyx_v_f[0]) = 90;
26582  (__pyx_v_f[1]) = 0x64;
26583  __pyx_v_f = (__pyx_v_f + 1);
26584  goto __pyx_L15;
26585  }
26586 
26587  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":898
26588  * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
26589  * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
26590  * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<<
26591  * elif t == NPY_OBJECT: f[0] = 79 #"O"
26592  * else:
26593  */
26594  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 898, __pyx_L1_error)
26595  __Pyx_GOTREF(__pyx_t_3);
26596  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 898, __pyx_L1_error)
26597  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26598  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 898, __pyx_L1_error)
26599  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26600  if (__pyx_t_6) {
26601  (__pyx_v_f[0]) = 90;
26602  (__pyx_v_f[1]) = 0x67;
26603  __pyx_v_f = (__pyx_v_f + 1);
26604  goto __pyx_L15;
26605  }
26606 
26607  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":899
26608  * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
26609  * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
26610  * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<<
26611  * else:
26612  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
26613  */
26614  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 899, __pyx_L1_error)
26615  __Pyx_GOTREF(__pyx_t_4);
26616  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 899, __pyx_L1_error)
26617  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26618  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 899, __pyx_L1_error)
26619  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26620  if (likely(__pyx_t_6)) {
26621  (__pyx_v_f[0]) = 79;
26622  goto __pyx_L15;
26623  }
26624 
26625  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":901
26626  * elif t == NPY_OBJECT: f[0] = 79 #"O"
26627  * else:
26628  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
26629  * f += 1
26630  * else:
26631  */
26632  /*else*/ {
26633  __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 901, __pyx_L1_error)
26634  __Pyx_GOTREF(__pyx_t_3);
26635  __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 901, __pyx_L1_error)
26636  __Pyx_GOTREF(__pyx_t_4);
26637  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26638  __Pyx_Raise(__pyx_t_4, 0, 0, 0);
26639  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26640  __PYX_ERR(1, 901, __pyx_L1_error)
26641  }
26642  __pyx_L15:;
26643 
26644  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":902
26645  * else:
26646  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
26647  * f += 1 # <<<<<<<<<<<<<<
26648  * else:
26649  * # Cython ignores struct boundary information ("T{...}"),
26650  */
26651  __pyx_v_f = (__pyx_v_f + 1);
26652 
26653  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":877
26654  * offset[0] += child.itemsize
26655  *
26656  * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
26657  * t = child.type_num
26658  * if end - f < 5:
26659  */
26660  goto __pyx_L13;
26661  }
26662 
26663  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":906
26664  * # Cython ignores struct boundary information ("T{...}"),
26665  * # so don't output it
26666  * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<<
26667  * return f
26668  *
26669  */
26670  /*else*/ {
26671  __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 906, __pyx_L1_error)
26672  __pyx_v_f = __pyx_t_9;
26673  }
26674  __pyx_L13:;
26675 
26676  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":851
26677  * cdef tuple fields
26678  *
26679  * for childname in descr.names: # <<<<<<<<<<<<<<
26680  * fields = descr.fields[childname]
26681  * child, new_offset = fields
26682  */
26683  }
26684  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
26685 
26686  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":907
26687  * # so don't output it
26688  * f = _util_dtypestring(child, f, end, offset)
26689  * return f # <<<<<<<<<<<<<<
26690  *
26691  *
26692  */
26693  __pyx_r = __pyx_v_f;
26694  goto __pyx_L0;
26695 
26696  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":842
26697  * return ()
26698  *
26699  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
26700  * # Recursive utility function used in __getbuffer__ to get format
26701  * # string. The new location in the format string is returned.
26702  */
26703 
26704  /* function exit code */
26705  __pyx_L1_error:;
26706  __Pyx_XDECREF(__pyx_t_1);
26707  __Pyx_XDECREF(__pyx_t_3);
26708  __Pyx_XDECREF(__pyx_t_4);
26709  __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
26710  __pyx_r = NULL;
26711  __pyx_L0:;
26712  __Pyx_XDECREF((PyObject *)__pyx_v_child);
26713  __Pyx_XDECREF(__pyx_v_fields);
26714  __Pyx_XDECREF(__pyx_v_childname);
26715  __Pyx_XDECREF(__pyx_v_new_offset);
26716  __Pyx_XDECREF(__pyx_v_t);
26717  __Pyx_RefNannyFinishContext();
26718  return __pyx_r;
26719 }
26720 
26721 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1022
26722  * int _import_umath() except -1
26723  *
26724  * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
26725  * Py_INCREF(base) # important to do this before stealing the reference below!
26726  * PyArray_SetBaseObject(arr, base)
26727  */
26728 
26729 static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
26730  __Pyx_RefNannyDeclarations
26731  __Pyx_RefNannySetupContext("set_array_base", 0);
26732 
26733  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1023
26734  *
26735  * cdef inline void set_array_base(ndarray arr, object base):
26736  * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<<
26737  * PyArray_SetBaseObject(arr, base)
26738  *
26739  */
26740  Py_INCREF(__pyx_v_base);
26741 
26742  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1024
26743  * cdef inline void set_array_base(ndarray arr, object base):
26744  * Py_INCREF(base) # important to do this before stealing the reference below!
26745  * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<<
26746  *
26747  * cdef inline object get_array_base(ndarray arr):
26748  */
26749  (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
26750 
26751  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1022
26752  * int _import_umath() except -1
26753  *
26754  * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
26755  * Py_INCREF(base) # important to do this before stealing the reference below!
26756  * PyArray_SetBaseObject(arr, base)
26757  */
26758 
26759  /* function exit code */
26760  __Pyx_RefNannyFinishContext();
26761 }
26762 
26763 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1026
26764  * PyArray_SetBaseObject(arr, base)
26765  *
26766  * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
26767  * base = PyArray_BASE(arr)
26768  * if base is NULL:
26769  */
26770 
26771 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
26772  PyObject *__pyx_v_base;
26773  PyObject *__pyx_r = NULL;
26774  __Pyx_RefNannyDeclarations
26775  int __pyx_t_1;
26776  __Pyx_RefNannySetupContext("get_array_base", 0);
26777 
26778  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1027
26779  *
26780  * cdef inline object get_array_base(ndarray arr):
26781  * base = PyArray_BASE(arr) # <<<<<<<<<<<<<<
26782  * if base is NULL:
26783  * return None
26784  */
26785  __pyx_v_base = PyArray_BASE(__pyx_v_arr);
26786 
26787  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1028
26788  * cdef inline object get_array_base(ndarray arr):
26789  * base = PyArray_BASE(arr)
26790  * if base is NULL: # <<<<<<<<<<<<<<
26791  * return None
26792  * return <object>base
26793  */
26794  __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
26795  if (__pyx_t_1) {
26796 
26797  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1029
26798  * base = PyArray_BASE(arr)
26799  * if base is NULL:
26800  * return None # <<<<<<<<<<<<<<
26801  * return <object>base
26802  *
26803  */
26804  __Pyx_XDECREF(__pyx_r);
26805  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
26806  goto __pyx_L0;
26807 
26808  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1028
26809  * cdef inline object get_array_base(ndarray arr):
26810  * base = PyArray_BASE(arr)
26811  * if base is NULL: # <<<<<<<<<<<<<<
26812  * return None
26813  * return <object>base
26814  */
26815  }
26816 
26817  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1030
26818  * if base is NULL:
26819  * return None
26820  * return <object>base # <<<<<<<<<<<<<<
26821  *
26822  * # Versions of the import_* functions which are more suitable for
26823  */
26824  __Pyx_XDECREF(__pyx_r);
26825  __Pyx_INCREF(((PyObject *)__pyx_v_base));
26826  __pyx_r = ((PyObject *)__pyx_v_base);
26827  goto __pyx_L0;
26828 
26829  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1026
26830  * PyArray_SetBaseObject(arr, base)
26831  *
26832  * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
26833  * base = PyArray_BASE(arr)
26834  * if base is NULL:
26835  */
26836 
26837  /* function exit code */
26838  __pyx_L0:;
26839  __Pyx_XGIVEREF(__pyx_r);
26840  __Pyx_RefNannyFinishContext();
26841  return __pyx_r;
26842 }
26843 
26844 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1034
26845  * # Versions of the import_* functions which are more suitable for
26846  * # Cython code.
26847  * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
26848  * try:
26849  * _import_array()
26850  */
26851 
26852 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
26853  int __pyx_r;
26854  __Pyx_RefNannyDeclarations
26855  PyObject *__pyx_t_1 = NULL;
26856  PyObject *__pyx_t_2 = NULL;
26857  PyObject *__pyx_t_3 = NULL;
26858  int __pyx_t_4;
26859  PyObject *__pyx_t_5 = NULL;
26860  PyObject *__pyx_t_6 = NULL;
26861  PyObject *__pyx_t_7 = NULL;
26862  PyObject *__pyx_t_8 = NULL;
26863  __Pyx_RefNannySetupContext("import_array", 0);
26864 
26865  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1035
26866  * # Cython code.
26867  * cdef inline int import_array() except -1:
26868  * try: # <<<<<<<<<<<<<<
26869  * _import_array()
26870  * except Exception:
26871  */
26872  {
26873  __Pyx_PyThreadState_declare
26874  __Pyx_PyThreadState_assign
26875  __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
26876  __Pyx_XGOTREF(__pyx_t_1);
26877  __Pyx_XGOTREF(__pyx_t_2);
26878  __Pyx_XGOTREF(__pyx_t_3);
26879  /*try:*/ {
26880 
26881  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1036
26882  * cdef inline int import_array() except -1:
26883  * try:
26884  * _import_array() # <<<<<<<<<<<<<<
26885  * except Exception:
26886  * raise ImportError("numpy.core.multiarray failed to import")
26887  */
26888  __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1036, __pyx_L3_error)
26889 
26890  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1035
26891  * # Cython code.
26892  * cdef inline int import_array() except -1:
26893  * try: # <<<<<<<<<<<<<<
26894  * _import_array()
26895  * except Exception:
26896  */
26897  }
26898  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
26899  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
26900  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
26901  goto __pyx_L8_try_end;
26902  __pyx_L3_error:;
26903 
26904  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1037
26905  * try:
26906  * _import_array()
26907  * except Exception: # <<<<<<<<<<<<<<
26908  * raise ImportError("numpy.core.multiarray failed to import")
26909  *
26910  */
26911  __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
26912  if (__pyx_t_4) {
26913  __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
26914  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1037, __pyx_L5_except_error)
26915  __Pyx_GOTREF(__pyx_t_5);
26916  __Pyx_GOTREF(__pyx_t_6);
26917  __Pyx_GOTREF(__pyx_t_7);
26918 
26919  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1038
26920  * _import_array()
26921  * except Exception:
26922  * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
26923  *
26924  * cdef inline int import_umath() except -1:
26925  */
26926  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1038, __pyx_L5_except_error)
26927  __Pyx_GOTREF(__pyx_t_8);
26928  __Pyx_Raise(__pyx_t_8, 0, 0, 0);
26929  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
26930  __PYX_ERR(1, 1038, __pyx_L5_except_error)
26931  }
26932  goto __pyx_L5_except_error;
26933  __pyx_L5_except_error:;
26934 
26935  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1035
26936  * # Cython code.
26937  * cdef inline int import_array() except -1:
26938  * try: # <<<<<<<<<<<<<<
26939  * _import_array()
26940  * except Exception:
26941  */
26942  __Pyx_XGIVEREF(__pyx_t_1);
26943  __Pyx_XGIVEREF(__pyx_t_2);
26944  __Pyx_XGIVEREF(__pyx_t_3);
26945  __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
26946  goto __pyx_L1_error;
26947  __pyx_L8_try_end:;
26948  }
26949 
26950  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1034
26951  * # Versions of the import_* functions which are more suitable for
26952  * # Cython code.
26953  * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
26954  * try:
26955  * _import_array()
26956  */
26957 
26958  /* function exit code */
26959  __pyx_r = 0;
26960  goto __pyx_L0;
26961  __pyx_L1_error:;
26962  __Pyx_XDECREF(__pyx_t_5);
26963  __Pyx_XDECREF(__pyx_t_6);
26964  __Pyx_XDECREF(__pyx_t_7);
26965  __Pyx_XDECREF(__pyx_t_8);
26966  __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
26967  __pyx_r = -1;
26968  __pyx_L0:;
26969  __Pyx_RefNannyFinishContext();
26970  return __pyx_r;
26971 }
26972 
26973 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1040
26974  * raise ImportError("numpy.core.multiarray failed to import")
26975  *
26976  * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
26977  * try:
26978  * _import_umath()
26979  */
26980 
26981 static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
26982  int __pyx_r;
26983  __Pyx_RefNannyDeclarations
26984  PyObject *__pyx_t_1 = NULL;
26985  PyObject *__pyx_t_2 = NULL;
26986  PyObject *__pyx_t_3 = NULL;
26987  int __pyx_t_4;
26988  PyObject *__pyx_t_5 = NULL;
26989  PyObject *__pyx_t_6 = NULL;
26990  PyObject *__pyx_t_7 = NULL;
26991  PyObject *__pyx_t_8 = NULL;
26992  __Pyx_RefNannySetupContext("import_umath", 0);
26993 
26994  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1041
26995  *
26996  * cdef inline int import_umath() except -1:
26997  * try: # <<<<<<<<<<<<<<
26998  * _import_umath()
26999  * except Exception:
27000  */
27001  {
27002  __Pyx_PyThreadState_declare
27003  __Pyx_PyThreadState_assign
27004  __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
27005  __Pyx_XGOTREF(__pyx_t_1);
27006  __Pyx_XGOTREF(__pyx_t_2);
27007  __Pyx_XGOTREF(__pyx_t_3);
27008  /*try:*/ {
27009 
27010  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1042
27011  * cdef inline int import_umath() except -1:
27012  * try:
27013  * _import_umath() # <<<<<<<<<<<<<<
27014  * except Exception:
27015  * raise ImportError("numpy.core.umath failed to import")
27016  */
27017  __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1042, __pyx_L3_error)
27018 
27019  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1041
27020  *
27021  * cdef inline int import_umath() except -1:
27022  * try: # <<<<<<<<<<<<<<
27023  * _import_umath()
27024  * except Exception:
27025  */
27026  }
27027  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
27028  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
27029  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
27030  goto __pyx_L8_try_end;
27031  __pyx_L3_error:;
27032 
27033  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1043
27034  * try:
27035  * _import_umath()
27036  * except Exception: # <<<<<<<<<<<<<<
27037  * raise ImportError("numpy.core.umath failed to import")
27038  *
27039  */
27040  __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
27041  if (__pyx_t_4) {
27042  __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
27043  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1043, __pyx_L5_except_error)
27044  __Pyx_GOTREF(__pyx_t_5);
27045  __Pyx_GOTREF(__pyx_t_6);
27046  __Pyx_GOTREF(__pyx_t_7);
27047 
27048  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1044
27049  * _import_umath()
27050  * except Exception:
27051  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
27052  *
27053  * cdef inline int import_ufunc() except -1:
27054  */
27055  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1044, __pyx_L5_except_error)
27056  __Pyx_GOTREF(__pyx_t_8);
27057  __Pyx_Raise(__pyx_t_8, 0, 0, 0);
27058  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
27059  __PYX_ERR(1, 1044, __pyx_L5_except_error)
27060  }
27061  goto __pyx_L5_except_error;
27062  __pyx_L5_except_error:;
27063 
27064  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1041
27065  *
27066  * cdef inline int import_umath() except -1:
27067  * try: # <<<<<<<<<<<<<<
27068  * _import_umath()
27069  * except Exception:
27070  */
27071  __Pyx_XGIVEREF(__pyx_t_1);
27072  __Pyx_XGIVEREF(__pyx_t_2);
27073  __Pyx_XGIVEREF(__pyx_t_3);
27074  __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
27075  goto __pyx_L1_error;
27076  __pyx_L8_try_end:;
27077  }
27078 
27079  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1040
27080  * raise ImportError("numpy.core.multiarray failed to import")
27081  *
27082  * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
27083  * try:
27084  * _import_umath()
27085  */
27086 
27087  /* function exit code */
27088  __pyx_r = 0;
27089  goto __pyx_L0;
27090  __pyx_L1_error:;
27091  __Pyx_XDECREF(__pyx_t_5);
27092  __Pyx_XDECREF(__pyx_t_6);
27093  __Pyx_XDECREF(__pyx_t_7);
27094  __Pyx_XDECREF(__pyx_t_8);
27095  __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
27096  __pyx_r = -1;
27097  __pyx_L0:;
27098  __Pyx_RefNannyFinishContext();
27099  return __pyx_r;
27100 }
27101 
27102 /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1046
27103  * raise ImportError("numpy.core.umath failed to import")
27104  *
27105  * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
27106  * try:
27107  * _import_umath()
27108  */
27109 
27110 static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
27111  int __pyx_r;
27112  __Pyx_RefNannyDeclarations
27113  PyObject *__pyx_t_1 = NULL;
27114  PyObject *__pyx_t_2 = NULL;
27115  PyObject *__pyx_t_3 = NULL;
27116  int __pyx_t_4;
27117  PyObject *__pyx_t_5 = NULL;
27118  PyObject *__pyx_t_6 = NULL;
27119  PyObject *__pyx_t_7 = NULL;
27120  PyObject *__pyx_t_8 = NULL;
27121  __Pyx_RefNannySetupContext("import_ufunc", 0);
27122 
27123  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1047
27124  *
27125  * cdef inline int import_ufunc() except -1:
27126  * try: # <<<<<<<<<<<<<<
27127  * _import_umath()
27128  * except Exception:
27129  */
27130  {
27131  __Pyx_PyThreadState_declare
27132  __Pyx_PyThreadState_assign
27133  __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
27134  __Pyx_XGOTREF(__pyx_t_1);
27135  __Pyx_XGOTREF(__pyx_t_2);
27136  __Pyx_XGOTREF(__pyx_t_3);
27137  /*try:*/ {
27138 
27139  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1048
27140  * cdef inline int import_ufunc() except -1:
27141  * try:
27142  * _import_umath() # <<<<<<<<<<<<<<
27143  * except Exception:
27144  * raise ImportError("numpy.core.umath failed to import")
27145  */
27146  __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1048, __pyx_L3_error)
27147 
27148  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1047
27149  *
27150  * cdef inline int import_ufunc() except -1:
27151  * try: # <<<<<<<<<<<<<<
27152  * _import_umath()
27153  * except Exception:
27154  */
27155  }
27156  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
27157  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
27158  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
27159  goto __pyx_L8_try_end;
27160  __pyx_L3_error:;
27161 
27162  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1049
27163  * try:
27164  * _import_umath()
27165  * except Exception: # <<<<<<<<<<<<<<
27166  * raise ImportError("numpy.core.umath failed to import")
27167  */
27168  __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
27169  if (__pyx_t_4) {
27170  __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
27171  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1049, __pyx_L5_except_error)
27172  __Pyx_GOTREF(__pyx_t_5);
27173  __Pyx_GOTREF(__pyx_t_6);
27174  __Pyx_GOTREF(__pyx_t_7);
27175 
27176  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1050
27177  * _import_umath()
27178  * except Exception:
27179  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
27180  */
27181  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1050, __pyx_L5_except_error)
27182  __Pyx_GOTREF(__pyx_t_8);
27183  __Pyx_Raise(__pyx_t_8, 0, 0, 0);
27184  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
27185  __PYX_ERR(1, 1050, __pyx_L5_except_error)
27186  }
27187  goto __pyx_L5_except_error;
27188  __pyx_L5_except_error:;
27189 
27190  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1047
27191  *
27192  * cdef inline int import_ufunc() except -1:
27193  * try: # <<<<<<<<<<<<<<
27194  * _import_umath()
27195  * except Exception:
27196  */
27197  __Pyx_XGIVEREF(__pyx_t_1);
27198  __Pyx_XGIVEREF(__pyx_t_2);
27199  __Pyx_XGIVEREF(__pyx_t_3);
27200  __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
27201  goto __pyx_L1_error;
27202  __pyx_L8_try_end:;
27203  }
27204 
27205  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1046
27206  * raise ImportError("numpy.core.umath failed to import")
27207  *
27208  * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
27209  * try:
27210  * _import_umath()
27211  */
27212 
27213  /* function exit code */
27214  __pyx_r = 0;
27215  goto __pyx_L0;
27216  __pyx_L1_error:;
27217  __Pyx_XDECREF(__pyx_t_5);
27218  __Pyx_XDECREF(__pyx_t_6);
27219  __Pyx_XDECREF(__pyx_t_7);
27220  __Pyx_XDECREF(__pyx_t_8);
27221  __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
27222  __pyx_r = -1;
27223  __pyx_L0:;
27224  __Pyx_RefNannyFinishContext();
27225  return __pyx_r;
27226 }
27227 
27228 /* "View.MemoryView":122
27229  * cdef bint dtype_is_object
27230  *
27231  * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<<
27232  * mode="c", bint allocate_buffer=True):
27233  *
27234  */
27235 
27236 /* Python wrapper */
27237 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
27238 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
27239  PyObject *__pyx_v_shape = 0;
27240  Py_ssize_t __pyx_v_itemsize;
27241  PyObject *__pyx_v_format = 0;
27242  PyObject *__pyx_v_mode = 0;
27243  int __pyx_v_allocate_buffer;
27244  int __pyx_r;
27245  __Pyx_RefNannyDeclarations
27246  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
27247  {
27248  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0};
27249  PyObject* values[5] = {0,0,0,0,0};
27250  values[3] = ((PyObject *)__pyx_n_s_c);
27251  if (unlikely(__pyx_kwds)) {
27252  Py_ssize_t kw_args;
27253  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
27254  switch (pos_args) {
27255  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
27256  CYTHON_FALLTHROUGH;
27257  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
27258  CYTHON_FALLTHROUGH;
27259  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
27260  CYTHON_FALLTHROUGH;
27261  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
27262  CYTHON_FALLTHROUGH;
27263  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
27264  CYTHON_FALLTHROUGH;
27265  case 0: break;
27266  default: goto __pyx_L5_argtuple_error;
27267  }
27268  kw_args = PyDict_Size(__pyx_kwds);
27269  switch (pos_args) {
27270  case 0:
27271  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
27272  else goto __pyx_L5_argtuple_error;
27273  CYTHON_FALLTHROUGH;
27274  case 1:
27275  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
27276  else {
27277  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(2, 122, __pyx_L3_error)
27278  }
27279  CYTHON_FALLTHROUGH;
27280  case 2:
27281  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
27282  else {
27283  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(2, 122, __pyx_L3_error)
27284  }
27285  CYTHON_FALLTHROUGH;
27286  case 3:
27287  if (kw_args > 0) {
27288  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode);
27289  if (value) { values[3] = value; kw_args--; }
27290  }
27291  CYTHON_FALLTHROUGH;
27292  case 4:
27293  if (kw_args > 0) {
27294  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer);
27295  if (value) { values[4] = value; kw_args--; }
27296  }
27297  }
27298  if (unlikely(kw_args > 0)) {
27299  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 122, __pyx_L3_error)
27300  }
27301  } else {
27302  switch (PyTuple_GET_SIZE(__pyx_args)) {
27303  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
27304  CYTHON_FALLTHROUGH;
27305  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
27306  CYTHON_FALLTHROUGH;
27307  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
27308  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
27309  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
27310  break;
27311  default: goto __pyx_L5_argtuple_error;
27312  }
27313  }
27314  __pyx_v_shape = ((PyObject*)values[0]);
27315  __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 122, __pyx_L3_error)
27316  __pyx_v_format = values[2];
27317  __pyx_v_mode = values[3];
27318  if (values[4]) {
27319  __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 123, __pyx_L3_error)
27320  } else {
27321 
27322  /* "View.MemoryView":123
27323  *
27324  * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,
27325  * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<<
27326  *
27327  * cdef int idx
27328  */
27329  __pyx_v_allocate_buffer = ((int)1);
27330  }
27331  }
27332  goto __pyx_L4_argument_unpacking_done;
27333  __pyx_L5_argtuple_error:;
27334  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 122, __pyx_L3_error)
27335  __pyx_L3_error:;
27336  __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
27337  __Pyx_RefNannyFinishContext();
27338  return -1;
27339  __pyx_L4_argument_unpacking_done:;
27340  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(2, 122, __pyx_L1_error)
27341  if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
27342  PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(2, 122, __pyx_L1_error)
27343  }
27344  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer);
27345 
27346  /* "View.MemoryView":122
27347  * cdef bint dtype_is_object
27348  *
27349  * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<<
27350  * mode="c", bint allocate_buffer=True):
27351  *
27352  */
27353 
27354  /* function exit code */
27355  goto __pyx_L0;
27356  __pyx_L1_error:;
27357  __pyx_r = -1;
27358  __pyx_L0:;
27359  __Pyx_RefNannyFinishContext();
27360  return __pyx_r;
27361 }
27362 
27363 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) {
27364  int __pyx_v_idx;
27365  Py_ssize_t __pyx_v_i;
27366  Py_ssize_t __pyx_v_dim;
27367  PyObject **__pyx_v_p;
27368  char __pyx_v_order;
27369  int __pyx_r;
27370  __Pyx_RefNannyDeclarations
27371  Py_ssize_t __pyx_t_1;
27372  int __pyx_t_2;
27373  PyObject *__pyx_t_3 = NULL;
27374  int __pyx_t_4;
27375  PyObject *__pyx_t_5 = NULL;
27376  PyObject *__pyx_t_6 = NULL;
27377  char *__pyx_t_7;
27378  int __pyx_t_8;
27379  Py_ssize_t __pyx_t_9;
27380  PyObject *__pyx_t_10 = NULL;
27381  Py_ssize_t __pyx_t_11;
27382  __Pyx_RefNannySetupContext("__cinit__", 0);
27383  __Pyx_INCREF(__pyx_v_format);
27384 
27385  /* "View.MemoryView":129
27386  * cdef PyObject **p
27387  *
27388  * self.ndim = <int> len(shape) # <<<<<<<<<<<<<<
27389  * self.itemsize = itemsize
27390  *
27391  */
27392  if (unlikely(__pyx_v_shape == Py_None)) {
27393  PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
27394  __PYX_ERR(2, 129, __pyx_L1_error)
27395  }
27396  __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(2, 129, __pyx_L1_error)
27397  __pyx_v_self->ndim = ((int)__pyx_t_1);
27398 
27399  /* "View.MemoryView":130
27400  *
27401  * self.ndim = <int> len(shape)
27402  * self.itemsize = itemsize # <<<<<<<<<<<<<<
27403  *
27404  * if not self.ndim:
27405  */
27406  __pyx_v_self->itemsize = __pyx_v_itemsize;
27407 
27408  /* "View.MemoryView":132
27409  * self.itemsize = itemsize
27410  *
27411  * if not self.ndim: # <<<<<<<<<<<<<<
27412  * raise ValueError("Empty shape tuple for cython.array")
27413  *
27414  */
27415  __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
27416  if (unlikely(__pyx_t_2)) {
27417 
27418  /* "View.MemoryView":133
27419  *
27420  * if not self.ndim:
27421  * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<<
27422  *
27423  * if itemsize <= 0:
27424  */
27425  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 133, __pyx_L1_error)
27426  __Pyx_GOTREF(__pyx_t_3);
27427  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
27428  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
27429  __PYX_ERR(2, 133, __pyx_L1_error)
27430 
27431  /* "View.MemoryView":132
27432  * self.itemsize = itemsize
27433  *
27434  * if not self.ndim: # <<<<<<<<<<<<<<
27435  * raise ValueError("Empty shape tuple for cython.array")
27436  *
27437  */
27438  }
27439 
27440  /* "View.MemoryView":135
27441  * raise ValueError("Empty shape tuple for cython.array")
27442  *
27443  * if itemsize <= 0: # <<<<<<<<<<<<<<
27444  * raise ValueError("itemsize <= 0 for cython.array")
27445  *
27446  */
27447  __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0);
27448  if (unlikely(__pyx_t_2)) {
27449 
27450  /* "View.MemoryView":136
27451  *
27452  * if itemsize <= 0:
27453  * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<<
27454  *
27455  * if not isinstance(format, bytes):
27456  */
27457  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 136, __pyx_L1_error)
27458  __Pyx_GOTREF(__pyx_t_3);
27459  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
27460  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
27461  __PYX_ERR(2, 136, __pyx_L1_error)
27462 
27463  /* "View.MemoryView":135
27464  * raise ValueError("Empty shape tuple for cython.array")
27465  *
27466  * if itemsize <= 0: # <<<<<<<<<<<<<<
27467  * raise ValueError("itemsize <= 0 for cython.array")
27468  *
27469  */
27470  }
27471 
27472  /* "View.MemoryView":138
27473  * raise ValueError("itemsize <= 0 for cython.array")
27474  *
27475  * if not isinstance(format, bytes): # <<<<<<<<<<<<<<
27476  * format = format.encode('ASCII')
27477  * self._format = format # keep a reference to the byte string
27478  */
27479  __pyx_t_2 = PyBytes_Check(__pyx_v_format);
27480  __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
27481  if (__pyx_t_4) {
27482 
27483  /* "View.MemoryView":139
27484  *
27485  * if not isinstance(format, bytes):
27486  * format = format.encode('ASCII') # <<<<<<<<<<<<<<
27487  * self._format = format # keep a reference to the byte string
27488  * self.format = self._format
27489  */
27490  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 139, __pyx_L1_error)
27491  __Pyx_GOTREF(__pyx_t_5);
27492  __pyx_t_6 = NULL;
27493  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
27494  __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
27495  if (likely(__pyx_t_6)) {
27496  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
27497  __Pyx_INCREF(__pyx_t_6);
27498  __Pyx_INCREF(function);
27499  __Pyx_DECREF_SET(__pyx_t_5, function);
27500  }
27501  }
27502  __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_ASCII) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_ASCII);
27503  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
27504  if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 139, __pyx_L1_error)
27505  __Pyx_GOTREF(__pyx_t_3);
27506  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
27507  __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
27508  __pyx_t_3 = 0;
27509 
27510  /* "View.MemoryView":138
27511  * raise ValueError("itemsize <= 0 for cython.array")
27512  *
27513  * if not isinstance(format, bytes): # <<<<<<<<<<<<<<
27514  * format = format.encode('ASCII')
27515  * self._format = format # keep a reference to the byte string
27516  */
27517  }
27518 
27519  /* "View.MemoryView":140
27520  * if not isinstance(format, bytes):
27521  * format = format.encode('ASCII')
27522  * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<<
27523  * self.format = self._format
27524  *
27525  */
27526  if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) __PYX_ERR(2, 140, __pyx_L1_error)
27527  __pyx_t_3 = __pyx_v_format;
27528  __Pyx_INCREF(__pyx_t_3);
27529  __Pyx_GIVEREF(__pyx_t_3);
27530  __Pyx_GOTREF(__pyx_v_self->_format);
27531  __Pyx_DECREF(__pyx_v_self->_format);
27532  __pyx_v_self->_format = ((PyObject*)__pyx_t_3);
27533  __pyx_t_3 = 0;
27534 
27535  /* "View.MemoryView":141
27536  * format = format.encode('ASCII')
27537  * self._format = format # keep a reference to the byte string
27538  * self.format = self._format # <<<<<<<<<<<<<<
27539  *
27540  *
27541  */
27542  if (unlikely(__pyx_v_self->_format == Py_None)) {
27543  PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
27544  __PYX_ERR(2, 141, __pyx_L1_error)
27545  }
27546  __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(2, 141, __pyx_L1_error)
27547  __pyx_v_self->format = __pyx_t_7;
27548 
27549  /* "View.MemoryView":144
27550  *
27551  *
27552  * self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<<
27553  * self._strides = self._shape + self.ndim
27554  *
27555  */
27556  __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));
27557 
27558  /* "View.MemoryView":145
27559  *
27560  * self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)
27561  * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<<
27562  *
27563  * if not self._shape:
27564  */
27565  __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);
27566 
27567  /* "View.MemoryView":147
27568  * self._strides = self._shape + self.ndim
27569  *
27570  * if not self._shape: # <<<<<<<<<<<<<<
27571  * raise MemoryError("unable to allocate shape and strides.")
27572  *
27573  */
27574  __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0);
27575  if (unlikely(__pyx_t_4)) {
27576 
27577  /* "View.MemoryView":148
27578  *
27579  * if not self._shape:
27580  * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<<
27581  *
27582  *
27583  */
27584  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 148, __pyx_L1_error)
27585  __Pyx_GOTREF(__pyx_t_3);
27586  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
27587  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
27588  __PYX_ERR(2, 148, __pyx_L1_error)
27589 
27590  /* "View.MemoryView":147
27591  * self._strides = self._shape + self.ndim
27592  *
27593  * if not self._shape: # <<<<<<<<<<<<<<
27594  * raise MemoryError("unable to allocate shape and strides.")
27595  *
27596  */
27597  }
27598 
27599  /* "View.MemoryView":151
27600  *
27601  *
27602  * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<<
27603  * if dim <= 0:
27604  * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
27605  */
27606  __pyx_t_8 = 0;
27607  __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
27608  for (;;) {
27609  if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
27610  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
27611  __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(2, 151, __pyx_L1_error)
27612  #else
27613  __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 151, __pyx_L1_error)
27614  __Pyx_GOTREF(__pyx_t_5);
27615  #endif
27616  __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 151, __pyx_L1_error)
27617  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
27618  __pyx_v_dim = __pyx_t_9;
27619  __pyx_v_idx = __pyx_t_8;
27620  __pyx_t_8 = (__pyx_t_8 + 1);
27621 
27622  /* "View.MemoryView":152
27623  *
27624  * for idx, dim in enumerate(shape):
27625  * if dim <= 0: # <<<<<<<<<<<<<<
27626  * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
27627  * self._shape[idx] = dim
27628  */
27629  __pyx_t_4 = ((__pyx_v_dim <= 0) != 0);
27630  if (unlikely(__pyx_t_4)) {
27631 
27632  /* "View.MemoryView":153
27633  * for idx, dim in enumerate(shape):
27634  * if dim <= 0:
27635  * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) # <<<<<<<<<<<<<<
27636  * self._shape[idx] = dim
27637  *
27638  */
27639  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 153, __pyx_L1_error)
27640  __Pyx_GOTREF(__pyx_t_5);
27641  __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 153, __pyx_L1_error)
27642  __Pyx_GOTREF(__pyx_t_6);
27643  __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 153, __pyx_L1_error)
27644  __Pyx_GOTREF(__pyx_t_10);
27645  __Pyx_GIVEREF(__pyx_t_5);
27646  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
27647  __Pyx_GIVEREF(__pyx_t_6);
27648  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6);
27649  __pyx_t_5 = 0;
27650  __pyx_t_6 = 0;
27651  __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 153, __pyx_L1_error)
27652  __Pyx_GOTREF(__pyx_t_6);
27653  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
27654  __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 153, __pyx_L1_error)
27655  __Pyx_GOTREF(__pyx_t_10);
27656  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
27657  __Pyx_Raise(__pyx_t_10, 0, 0, 0);
27658  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
27659  __PYX_ERR(2, 153, __pyx_L1_error)
27660 
27661  /* "View.MemoryView":152
27662  *
27663  * for idx, dim in enumerate(shape):
27664  * if dim <= 0: # <<<<<<<<<<<<<<
27665  * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
27666  * self._shape[idx] = dim
27667  */
27668  }
27669 
27670  /* "View.MemoryView":154
27671  * if dim <= 0:
27672  * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
27673  * self._shape[idx] = dim # <<<<<<<<<<<<<<
27674  *
27675  * cdef char order
27676  */
27677  (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;
27678 
27679  /* "View.MemoryView":151
27680  *
27681  *
27682  * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<<
27683  * if dim <= 0:
27684  * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
27685  */
27686  }
27687  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
27688 
27689  /* "View.MemoryView":157
27690  *
27691  * cdef char order
27692  * if mode == 'fortran': # <<<<<<<<<<<<<<
27693  * order = b'F'
27694  * self.mode = u'fortran'
27695  */
27696  __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 157, __pyx_L1_error)
27697  if (__pyx_t_4) {
27698 
27699  /* "View.MemoryView":158
27700  * cdef char order
27701  * if mode == 'fortran':
27702  * order = b'F' # <<<<<<<<<<<<<<
27703  * self.mode = u'fortran'
27704  * elif mode == 'c':
27705  */
27706  __pyx_v_order = 'F';
27707 
27708  /* "View.MemoryView":159
27709  * if mode == 'fortran':
27710  * order = b'F'
27711  * self.mode = u'fortran' # <<<<<<<<<<<<<<
27712  * elif mode == 'c':
27713  * order = b'C'
27714  */
27715  __Pyx_INCREF(__pyx_n_u_fortran);
27716  __Pyx_GIVEREF(__pyx_n_u_fortran);
27717  __Pyx_GOTREF(__pyx_v_self->mode);
27718  __Pyx_DECREF(__pyx_v_self->mode);
27719  __pyx_v_self->mode = __pyx_n_u_fortran;
27720 
27721  /* "View.MemoryView":157
27722  *
27723  * cdef char order
27724  * if mode == 'fortran': # <<<<<<<<<<<<<<
27725  * order = b'F'
27726  * self.mode = u'fortran'
27727  */
27728  goto __pyx_L10;
27729  }
27730 
27731  /* "View.MemoryView":160
27732  * order = b'F'
27733  * self.mode = u'fortran'
27734  * elif mode == 'c': # <<<<<<<<<<<<<<
27735  * order = b'C'
27736  * self.mode = u'c'
27737  */
27738  __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 160, __pyx_L1_error)
27739  if (likely(__pyx_t_4)) {
27740 
27741  /* "View.MemoryView":161
27742  * self.mode = u'fortran'
27743  * elif mode == 'c':
27744  * order = b'C' # <<<<<<<<<<<<<<
27745  * self.mode = u'c'
27746  * else:
27747  */
27748  __pyx_v_order = 'C';
27749 
27750  /* "View.MemoryView":162
27751  * elif mode == 'c':
27752  * order = b'C'
27753  * self.mode = u'c' # <<<<<<<<<<<<<<
27754  * else:
27755  * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
27756  */
27757  __Pyx_INCREF(__pyx_n_u_c);
27758  __Pyx_GIVEREF(__pyx_n_u_c);
27759  __Pyx_GOTREF(__pyx_v_self->mode);
27760  __Pyx_DECREF(__pyx_v_self->mode);
27761  __pyx_v_self->mode = __pyx_n_u_c;
27762 
27763  /* "View.MemoryView":160
27764  * order = b'F'
27765  * self.mode = u'fortran'
27766  * elif mode == 'c': # <<<<<<<<<<<<<<
27767  * order = b'C'
27768  * self.mode = u'c'
27769  */
27770  goto __pyx_L10;
27771  }
27772 
27773  /* "View.MemoryView":164
27774  * self.mode = u'c'
27775  * else:
27776  * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) # <<<<<<<<<<<<<<
27777  *
27778  * self.len = fill_contig_strides_array(self._shape, self._strides,
27779  */
27780  /*else*/ {
27781  __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 164, __pyx_L1_error)
27782  __Pyx_GOTREF(__pyx_t_3);
27783  __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 164, __pyx_L1_error)
27784  __Pyx_GOTREF(__pyx_t_10);
27785  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
27786  __Pyx_Raise(__pyx_t_10, 0, 0, 0);
27787  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
27788  __PYX_ERR(2, 164, __pyx_L1_error)
27789  }
27790  __pyx_L10:;
27791 
27792  /* "View.MemoryView":166
27793  * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
27794  *
27795  * self.len = fill_contig_strides_array(self._shape, self._strides, # <<<<<<<<<<<<<<
27796  * itemsize, self.ndim, order)
27797  *
27798  */
27799  __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order);
27800 
27801  /* "View.MemoryView":169
27802  * itemsize, self.ndim, order)
27803  *
27804  * self.free_data = allocate_buffer # <<<<<<<<<<<<<<
27805  * self.dtype_is_object = format == b'O'
27806  * if allocate_buffer:
27807  */
27808  __pyx_v_self->free_data = __pyx_v_allocate_buffer;
27809 
27810  /* "View.MemoryView":170
27811  *
27812  * self.free_data = allocate_buffer
27813  * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<<
27814  * if allocate_buffer:
27815  *
27816  */
27817  __pyx_t_10 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 170, __pyx_L1_error)
27818  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 170, __pyx_L1_error)
27819  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
27820  __pyx_v_self->dtype_is_object = __pyx_t_4;
27821 
27822  /* "View.MemoryView":171
27823  * self.free_data = allocate_buffer
27824  * self.dtype_is_object = format == b'O'
27825  * if allocate_buffer: # <<<<<<<<<<<<<<
27826  *
27827  *
27828  */
27829  __pyx_t_4 = (__pyx_v_allocate_buffer != 0);
27830  if (__pyx_t_4) {
27831 
27832  /* "View.MemoryView":174
27833  *
27834  *
27835  * self.data = <char *>malloc(self.len) # <<<<<<<<<<<<<<
27836  * if not self.data:
27837  * raise MemoryError("unable to allocate array data.")
27838  */
27839  __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len));
27840 
27841  /* "View.MemoryView":175
27842  *
27843  * self.data = <char *>malloc(self.len)
27844  * if not self.data: # <<<<<<<<<<<<<<
27845  * raise MemoryError("unable to allocate array data.")
27846  *
27847  */
27848  __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0);
27849  if (unlikely(__pyx_t_4)) {
27850 
27851  /* "View.MemoryView":176
27852  * self.data = <char *>malloc(self.len)
27853  * if not self.data:
27854  * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<<
27855  *
27856  * if self.dtype_is_object:
27857  */
27858  __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 176, __pyx_L1_error)
27859  __Pyx_GOTREF(__pyx_t_10);
27860  __Pyx_Raise(__pyx_t_10, 0, 0, 0);
27861  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
27862  __PYX_ERR(2, 176, __pyx_L1_error)
27863 
27864  /* "View.MemoryView":175
27865  *
27866  * self.data = <char *>malloc(self.len)
27867  * if not self.data: # <<<<<<<<<<<<<<
27868  * raise MemoryError("unable to allocate array data.")
27869  *
27870  */
27871  }
27872 
27873  /* "View.MemoryView":178
27874  * raise MemoryError("unable to allocate array data.")
27875  *
27876  * if self.dtype_is_object: # <<<<<<<<<<<<<<
27877  * p = <PyObject **> self.data
27878  * for i in range(self.len / itemsize):
27879  */
27880  __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0);
27881  if (__pyx_t_4) {
27882 
27883  /* "View.MemoryView":179
27884  *
27885  * if self.dtype_is_object:
27886  * p = <PyObject **> self.data # <<<<<<<<<<<<<<
27887  * for i in range(self.len / itemsize):
27888  * p[i] = Py_None
27889  */
27890  __pyx_v_p = ((PyObject **)__pyx_v_self->data);
27891 
27892  /* "View.MemoryView":180
27893  * if self.dtype_is_object:
27894  * p = <PyObject **> self.data
27895  * for i in range(self.len / itemsize): # <<<<<<<<<<<<<<
27896  * p[i] = Py_None
27897  * Py_INCREF(Py_None)
27898  */
27899  if (unlikely(__pyx_v_itemsize == 0)) {
27900  PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
27901  __PYX_ERR(2, 180, __pyx_L1_error)
27902  }
27903  else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) {
27904  PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
27905  __PYX_ERR(2, 180, __pyx_L1_error)
27906  }
27907  __pyx_t_1 = (__pyx_v_self->len / __pyx_v_itemsize);
27908  __pyx_t_9 = __pyx_t_1;
27909  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
27910  __pyx_v_i = __pyx_t_11;
27911 
27912  /* "View.MemoryView":181
27913  * p = <PyObject **> self.data
27914  * for i in range(self.len / itemsize):
27915  * p[i] = Py_None # <<<<<<<<<<<<<<
27916  * Py_INCREF(Py_None)
27917  *
27918  */
27919  (__pyx_v_p[__pyx_v_i]) = Py_None;
27920 
27921  /* "View.MemoryView":182
27922  * for i in range(self.len / itemsize):
27923  * p[i] = Py_None
27924  * Py_INCREF(Py_None) # <<<<<<<<<<<<<<
27925  *
27926  * @cname('getbuffer')
27927  */
27928  Py_INCREF(Py_None);
27929  }
27930 
27931  /* "View.MemoryView":178
27932  * raise MemoryError("unable to allocate array data.")
27933  *
27934  * if self.dtype_is_object: # <<<<<<<<<<<<<<
27935  * p = <PyObject **> self.data
27936  * for i in range(self.len / itemsize):
27937  */
27938  }
27939 
27940  /* "View.MemoryView":171
27941  * self.free_data = allocate_buffer
27942  * self.dtype_is_object = format == b'O'
27943  * if allocate_buffer: # <<<<<<<<<<<<<<
27944  *
27945  *
27946  */
27947  }
27948 
27949  /* "View.MemoryView":122
27950  * cdef bint dtype_is_object
27951  *
27952  * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<<
27953  * mode="c", bint allocate_buffer=True):
27954  *
27955  */
27956 
27957  /* function exit code */
27958  __pyx_r = 0;
27959  goto __pyx_L0;
27960  __pyx_L1_error:;
27961  __Pyx_XDECREF(__pyx_t_3);
27962  __Pyx_XDECREF(__pyx_t_5);
27963  __Pyx_XDECREF(__pyx_t_6);
27964  __Pyx_XDECREF(__pyx_t_10);
27965  __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
27966  __pyx_r = -1;
27967  __pyx_L0:;
27968  __Pyx_XDECREF(__pyx_v_format);
27969  __Pyx_RefNannyFinishContext();
27970  return __pyx_r;
27971 }
27972 
27973 /* "View.MemoryView":185
27974  *
27975  * @cname('getbuffer')
27976  * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
27977  * cdef int bufmode = -1
27978  * if self.mode == u"c":
27979  */
27980 
27981 /* Python wrapper */
27982 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
27983 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
27984  int __pyx_r;
27985  __Pyx_RefNannyDeclarations
27986  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
27987  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
27988 
27989  /* function exit code */
27990  __Pyx_RefNannyFinishContext();
27991  return __pyx_r;
27992 }
27993 
27994 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
27995  int __pyx_v_bufmode;
27996  int __pyx_r;
27997  __Pyx_RefNannyDeclarations
27998  int __pyx_t_1;
27999  int __pyx_t_2;
28000  PyObject *__pyx_t_3 = NULL;
28001  char *__pyx_t_4;
28002  Py_ssize_t __pyx_t_5;
28003  int __pyx_t_6;
28004  Py_ssize_t *__pyx_t_7;
28005  if (__pyx_v_info == NULL) {
28006  PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
28007  return -1;
28008  }
28009  __Pyx_RefNannySetupContext("__getbuffer__", 0);
28010  __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
28011  __Pyx_GIVEREF(__pyx_v_info->obj);
28012 
28013  /* "View.MemoryView":186
28014  * @cname('getbuffer')
28015  * def __getbuffer__(self, Py_buffer *info, int flags):
28016  * cdef int bufmode = -1 # <<<<<<<<<<<<<<
28017  * if self.mode == u"c":
28018  * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
28019  */
28020  __pyx_v_bufmode = -1;
28021 
28022  /* "View.MemoryView":187
28023  * def __getbuffer__(self, Py_buffer *info, int flags):
28024  * cdef int bufmode = -1
28025  * if self.mode == u"c": # <<<<<<<<<<<<<<
28026  * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
28027  * elif self.mode == u"fortran":
28028  */
28029  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 187, __pyx_L1_error)
28030  __pyx_t_2 = (__pyx_t_1 != 0);
28031  if (__pyx_t_2) {
28032 
28033  /* "View.MemoryView":188
28034  * cdef int bufmode = -1
28035  * if self.mode == u"c":
28036  * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<<
28037  * elif self.mode == u"fortran":
28038  * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
28039  */
28040  __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
28041 
28042  /* "View.MemoryView":187
28043  * def __getbuffer__(self, Py_buffer *info, int flags):
28044  * cdef int bufmode = -1
28045  * if self.mode == u"c": # <<<<<<<<<<<<<<
28046  * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
28047  * elif self.mode == u"fortran":
28048  */
28049  goto __pyx_L3;
28050  }
28051 
28052  /* "View.MemoryView":189
28053  * if self.mode == u"c":
28054  * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
28055  * elif self.mode == u"fortran": # <<<<<<<<<<<<<<
28056  * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
28057  * if not (flags & bufmode):
28058  */
28059  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 189, __pyx_L1_error)
28060  __pyx_t_1 = (__pyx_t_2 != 0);
28061  if (__pyx_t_1) {
28062 
28063  /* "View.MemoryView":190
28064  * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
28065  * elif self.mode == u"fortran":
28066  * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<<
28067  * if not (flags & bufmode):
28068  * raise ValueError("Can only create a buffer that is contiguous in memory.")
28069  */
28070  __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
28071 
28072  /* "View.MemoryView":189
28073  * if self.mode == u"c":
28074  * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
28075  * elif self.mode == u"fortran": # <<<<<<<<<<<<<<
28076  * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
28077  * if not (flags & bufmode):
28078  */
28079  }
28080  __pyx_L3:;
28081 
28082  /* "View.MemoryView":191
28083  * elif self.mode == u"fortran":
28084  * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
28085  * if not (flags & bufmode): # <<<<<<<<<<<<<<
28086  * raise ValueError("Can only create a buffer that is contiguous in memory.")
28087  * info.buf = self.data
28088  */
28089  __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
28090  if (unlikely(__pyx_t_1)) {
28091 
28092  /* "View.MemoryView":192
28093  * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
28094  * if not (flags & bufmode):
28095  * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<<
28096  * info.buf = self.data
28097  * info.len = self.len
28098  */
28099  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 192, __pyx_L1_error)
28100  __Pyx_GOTREF(__pyx_t_3);
28101  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
28102  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
28103  __PYX_ERR(2, 192, __pyx_L1_error)
28104 
28105  /* "View.MemoryView":191
28106  * elif self.mode == u"fortran":
28107  * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
28108  * if not (flags & bufmode): # <<<<<<<<<<<<<<
28109  * raise ValueError("Can only create a buffer that is contiguous in memory.")
28110  * info.buf = self.data
28111  */
28112  }
28113 
28114  /* "View.MemoryView":193
28115  * if not (flags & bufmode):
28116  * raise ValueError("Can only create a buffer that is contiguous in memory.")
28117  * info.buf = self.data # <<<<<<<<<<<<<<
28118  * info.len = self.len
28119  * info.ndim = self.ndim
28120  */
28121  __pyx_t_4 = __pyx_v_self->data;
28122  __pyx_v_info->buf = __pyx_t_4;
28123 
28124  /* "View.MemoryView":194
28125  * raise ValueError("Can only create a buffer that is contiguous in memory.")
28126  * info.buf = self.data
28127  * info.len = self.len # <<<<<<<<<<<<<<
28128  * info.ndim = self.ndim
28129  * info.shape = self._shape
28130  */
28131  __pyx_t_5 = __pyx_v_self->len;
28132  __pyx_v_info->len = __pyx_t_5;
28133 
28134  /* "View.MemoryView":195
28135  * info.buf = self.data
28136  * info.len = self.len
28137  * info.ndim = self.ndim # <<<<<<<<<<<<<<
28138  * info.shape = self._shape
28139  * info.strides = self._strides
28140  */
28141  __pyx_t_6 = __pyx_v_self->ndim;
28142  __pyx_v_info->ndim = __pyx_t_6;
28143 
28144  /* "View.MemoryView":196
28145  * info.len = self.len
28146  * info.ndim = self.ndim
28147  * info.shape = self._shape # <<<<<<<<<<<<<<
28148  * info.strides = self._strides
28149  * info.suboffsets = NULL
28150  */
28151  __pyx_t_7 = __pyx_v_self->_shape;
28152  __pyx_v_info->shape = __pyx_t_7;
28153 
28154  /* "View.MemoryView":197
28155  * info.ndim = self.ndim
28156  * info.shape = self._shape
28157  * info.strides = self._strides # <<<<<<<<<<<<<<
28158  * info.suboffsets = NULL
28159  * info.itemsize = self.itemsize
28160  */
28161  __pyx_t_7 = __pyx_v_self->_strides;
28162  __pyx_v_info->strides = __pyx_t_7;
28163 
28164  /* "View.MemoryView":198
28165  * info.shape = self._shape
28166  * info.strides = self._strides
28167  * info.suboffsets = NULL # <<<<<<<<<<<<<<
28168  * info.itemsize = self.itemsize
28169  * info.readonly = 0
28170  */
28171  __pyx_v_info->suboffsets = NULL;
28172 
28173  /* "View.MemoryView":199
28174  * info.strides = self._strides
28175  * info.suboffsets = NULL
28176  * info.itemsize = self.itemsize # <<<<<<<<<<<<<<
28177  * info.readonly = 0
28178  *
28179  */
28180  __pyx_t_5 = __pyx_v_self->itemsize;
28181  __pyx_v_info->itemsize = __pyx_t_5;
28182 
28183  /* "View.MemoryView":200
28184  * info.suboffsets = NULL
28185  * info.itemsize = self.itemsize
28186  * info.readonly = 0 # <<<<<<<<<<<<<<
28187  *
28188  * if flags & PyBUF_FORMAT:
28189  */
28190  __pyx_v_info->readonly = 0;
28191 
28192  /* "View.MemoryView":202
28193  * info.readonly = 0
28194  *
28195  * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
28196  * info.format = self.format
28197  * else:
28198  */
28199  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
28200  if (__pyx_t_1) {
28201 
28202  /* "View.MemoryView":203
28203  *
28204  * if flags & PyBUF_FORMAT:
28205  * info.format = self.format # <<<<<<<<<<<<<<
28206  * else:
28207  * info.format = NULL
28208  */
28209  __pyx_t_4 = __pyx_v_self->format;
28210  __pyx_v_info->format = __pyx_t_4;
28211 
28212  /* "View.MemoryView":202
28213  * info.readonly = 0
28214  *
28215  * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
28216  * info.format = self.format
28217  * else:
28218  */
28219  goto __pyx_L5;
28220  }
28221 
28222  /* "View.MemoryView":205
28223  * info.format = self.format
28224  * else:
28225  * info.format = NULL # <<<<<<<<<<<<<<
28226  *
28227  * info.obj = self
28228  */
28229  /*else*/ {
28230  __pyx_v_info->format = NULL;
28231  }
28232  __pyx_L5:;
28233 
28234  /* "View.MemoryView":207
28235  * info.format = NULL
28236  *
28237  * info.obj = self # <<<<<<<<<<<<<<
28238  *
28239  * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
28240  */
28241  __Pyx_INCREF(((PyObject *)__pyx_v_self));
28242  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
28243  __Pyx_GOTREF(__pyx_v_info->obj);
28244  __Pyx_DECREF(__pyx_v_info->obj);
28245  __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
28246 
28247  /* "View.MemoryView":185
28248  *
28249  * @cname('getbuffer')
28250  * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
28251  * cdef int bufmode = -1
28252  * if self.mode == u"c":
28253  */
28254 
28255  /* function exit code */
28256  __pyx_r = 0;
28257  goto __pyx_L0;
28258  __pyx_L1_error:;
28259  __Pyx_XDECREF(__pyx_t_3);
28260  __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
28261  __pyx_r = -1;
28262  if (__pyx_v_info->obj != NULL) {
28263  __Pyx_GOTREF(__pyx_v_info->obj);
28264  __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
28265  }
28266  goto __pyx_L2;
28267  __pyx_L0:;
28268  if (__pyx_v_info->obj == Py_None) {
28269  __Pyx_GOTREF(__pyx_v_info->obj);
28270  __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
28271  }
28272  __pyx_L2:;
28273  __Pyx_RefNannyFinishContext();
28274  return __pyx_r;
28275 }
28276 
28277 /* "View.MemoryView":211
28278  * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
28279  *
28280  * def __dealloc__(array self): # <<<<<<<<<<<<<<
28281  * if self.callback_free_data != NULL:
28282  * self.callback_free_data(self.data)
28283  */
28284 
28285 /* Python wrapper */
28286 static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/
28287 static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
28288  __Pyx_RefNannyDeclarations
28289  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
28290  __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self));
28291 
28292  /* function exit code */
28293  __Pyx_RefNannyFinishContext();
28294 }
28295 
28296 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) {
28297  __Pyx_RefNannyDeclarations
28298  int __pyx_t_1;
28299  __Pyx_RefNannySetupContext("__dealloc__", 0);
28300 
28301  /* "View.MemoryView":212
28302  *
28303  * def __dealloc__(array self):
28304  * if self.callback_free_data != NULL: # <<<<<<<<<<<<<<
28305  * self.callback_free_data(self.data)
28306  * elif self.free_data:
28307  */
28308  __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
28309  if (__pyx_t_1) {
28310 
28311  /* "View.MemoryView":213
28312  * def __dealloc__(array self):
28313  * if self.callback_free_data != NULL:
28314  * self.callback_free_data(self.data) # <<<<<<<<<<<<<<
28315  * elif self.free_data:
28316  * if self.dtype_is_object:
28317  */
28318  __pyx_v_self->callback_free_data(__pyx_v_self->data);
28319 
28320  /* "View.MemoryView":212
28321  *
28322  * def __dealloc__(array self):
28323  * if self.callback_free_data != NULL: # <<<<<<<<<<<<<<
28324  * self.callback_free_data(self.data)
28325  * elif self.free_data:
28326  */
28327  goto __pyx_L3;
28328  }
28329 
28330  /* "View.MemoryView":214
28331  * if self.callback_free_data != NULL:
28332  * self.callback_free_data(self.data)
28333  * elif self.free_data: # <<<<<<<<<<<<<<
28334  * if self.dtype_is_object:
28335  * refcount_objects_in_slice(self.data, self._shape,
28336  */
28337  __pyx_t_1 = (__pyx_v_self->free_data != 0);
28338  if (__pyx_t_1) {
28339 
28340  /* "View.MemoryView":215
28341  * self.callback_free_data(self.data)
28342  * elif self.free_data:
28343  * if self.dtype_is_object: # <<<<<<<<<<<<<<
28344  * refcount_objects_in_slice(self.data, self._shape,
28345  * self._strides, self.ndim, False)
28346  */
28347  __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
28348  if (__pyx_t_1) {
28349 
28350  /* "View.MemoryView":216
28351  * elif self.free_data:
28352  * if self.dtype_is_object:
28353  * refcount_objects_in_slice(self.data, self._shape, # <<<<<<<<<<<<<<
28354  * self._strides, self.ndim, False)
28355  * free(self.data)
28356  */
28357  __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);
28358 
28359  /* "View.MemoryView":215
28360  * self.callback_free_data(self.data)
28361  * elif self.free_data:
28362  * if self.dtype_is_object: # <<<<<<<<<<<<<<
28363  * refcount_objects_in_slice(self.data, self._shape,
28364  * self._strides, self.ndim, False)
28365  */
28366  }
28367 
28368  /* "View.MemoryView":218
28369  * refcount_objects_in_slice(self.data, self._shape,
28370  * self._strides, self.ndim, False)
28371  * free(self.data) # <<<<<<<<<<<<<<
28372  * PyObject_Free(self._shape)
28373  *
28374  */
28375  free(__pyx_v_self->data);
28376 
28377  /* "View.MemoryView":214
28378  * if self.callback_free_data != NULL:
28379  * self.callback_free_data(self.data)
28380  * elif self.free_data: # <<<<<<<<<<<<<<
28381  * if self.dtype_is_object:
28382  * refcount_objects_in_slice(self.data, self._shape,
28383  */
28384  }
28385  __pyx_L3:;
28386 
28387  /* "View.MemoryView":219
28388  * self._strides, self.ndim, False)
28389  * free(self.data)
28390  * PyObject_Free(self._shape) # <<<<<<<<<<<<<<
28391  *
28392  * @property
28393  */
28394  PyObject_Free(__pyx_v_self->_shape);
28395 
28396  /* "View.MemoryView":211
28397  * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
28398  *
28399  * def __dealloc__(array self): # <<<<<<<<<<<<<<
28400  * if self.callback_free_data != NULL:
28401  * self.callback_free_data(self.data)
28402  */
28403 
28404  /* function exit code */
28405  __Pyx_RefNannyFinishContext();
28406 }
28407 
28408 /* "View.MemoryView":222
28409  *
28410  * @property
28411  * def memview(self): # <<<<<<<<<<<<<<
28412  * return self.get_memview()
28413  *
28414  */
28415 
28416 /* Python wrapper */
28417 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/
28418 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
28419  PyObject *__pyx_r = 0;
28420  __Pyx_RefNannyDeclarations
28421  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
28422  __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self));
28423 
28424  /* function exit code */
28425  __Pyx_RefNannyFinishContext();
28426  return __pyx_r;
28427 }
28428 
28429 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) {
28430  PyObject *__pyx_r = NULL;
28431  __Pyx_RefNannyDeclarations
28432  PyObject *__pyx_t_1 = NULL;
28433  __Pyx_RefNannySetupContext("__get__", 0);
28434 
28435  /* "View.MemoryView":223
28436  * @property
28437  * def memview(self):
28438  * return self.get_memview() # <<<<<<<<<<<<<<
28439  *
28440  * @cname('get_memview')
28441  */
28442  __Pyx_XDECREF(__pyx_r);
28443  __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 223, __pyx_L1_error)
28444  __Pyx_GOTREF(__pyx_t_1);
28445  __pyx_r = __pyx_t_1;
28446  __pyx_t_1 = 0;
28447  goto __pyx_L0;
28448 
28449  /* "View.MemoryView":222
28450  *
28451  * @property
28452  * def memview(self): # <<<<<<<<<<<<<<
28453  * return self.get_memview()
28454  *
28455  */
28456 
28457  /* function exit code */
28458  __pyx_L1_error:;
28459  __Pyx_XDECREF(__pyx_t_1);
28460  __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
28461  __pyx_r = NULL;
28462  __pyx_L0:;
28463  __Pyx_XGIVEREF(__pyx_r);
28464  __Pyx_RefNannyFinishContext();
28465  return __pyx_r;
28466 }
28467 
28468 /* "View.MemoryView":226
28469  *
28470  * @cname('get_memview')
28471  * cdef get_memview(self): # <<<<<<<<<<<<<<
28472  * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
28473  * return memoryview(self, flags, self.dtype_is_object)
28474  */
28475 
28476 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) {
28477  int __pyx_v_flags;
28478  PyObject *__pyx_r = NULL;
28479  __Pyx_RefNannyDeclarations
28480  PyObject *__pyx_t_1 = NULL;
28481  PyObject *__pyx_t_2 = NULL;
28482  PyObject *__pyx_t_3 = NULL;
28483  __Pyx_RefNannySetupContext("get_memview", 0);
28484 
28485  /* "View.MemoryView":227
28486  * @cname('get_memview')
28487  * cdef get_memview(self):
28488  * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<<
28489  * return memoryview(self, flags, self.dtype_is_object)
28490  *
28491  */
28492  __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);
28493 
28494  /* "View.MemoryView":228
28495  * cdef get_memview(self):
28496  * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
28497  * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<<
28498  *
28499  * def __len__(self):
28500  */
28501  __Pyx_XDECREF(__pyx_r);
28502  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 228, __pyx_L1_error)
28503  __Pyx_GOTREF(__pyx_t_1);
28504  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 228, __pyx_L1_error)
28505  __Pyx_GOTREF(__pyx_t_2);
28506  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 228, __pyx_L1_error)
28507  __Pyx_GOTREF(__pyx_t_3);
28508  __Pyx_INCREF(((PyObject *)__pyx_v_self));
28509  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
28510  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
28511  __Pyx_GIVEREF(__pyx_t_1);
28512  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
28513  __Pyx_GIVEREF(__pyx_t_2);
28514  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
28515  __pyx_t_1 = 0;
28516  __pyx_t_2 = 0;
28517  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 228, __pyx_L1_error)
28518  __Pyx_GOTREF(__pyx_t_2);
28519  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
28520  __pyx_r = __pyx_t_2;
28521  __pyx_t_2 = 0;
28522  goto __pyx_L0;
28523 
28524  /* "View.MemoryView":226
28525  *
28526  * @cname('get_memview')
28527  * cdef get_memview(self): # <<<<<<<<<<<<<<
28528  * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
28529  * return memoryview(self, flags, self.dtype_is_object)
28530  */
28531 
28532  /* function exit code */
28533  __pyx_L1_error:;
28534  __Pyx_XDECREF(__pyx_t_1);
28535  __Pyx_XDECREF(__pyx_t_2);
28536  __Pyx_XDECREF(__pyx_t_3);
28537  __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
28538  __pyx_r = 0;
28539  __pyx_L0:;
28540  __Pyx_XGIVEREF(__pyx_r);
28541  __Pyx_RefNannyFinishContext();
28542  return __pyx_r;
28543 }
28544 
28545 /* "View.MemoryView":230
28546  * return memoryview(self, flags, self.dtype_is_object)
28547  *
28548  * def __len__(self): # <<<<<<<<<<<<<<
28549  * return self._shape[0]
28550  *
28551  */
28552 
28553 /* Python wrapper */
28554 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/
28555 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
28556  Py_ssize_t __pyx_r;
28557  __Pyx_RefNannyDeclarations
28558  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
28559  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self));
28560 
28561  /* function exit code */
28562  __Pyx_RefNannyFinishContext();
28563  return __pyx_r;
28564 }
28565 
28566 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) {
28567  Py_ssize_t __pyx_r;
28568  __Pyx_RefNannyDeclarations
28569  __Pyx_RefNannySetupContext("__len__", 0);
28570 
28571  /* "View.MemoryView":231
28572  *
28573  * def __len__(self):
28574  * return self._shape[0] # <<<<<<<<<<<<<<
28575  *
28576  * def __getattr__(self, attr):
28577  */
28578  __pyx_r = (__pyx_v_self->_shape[0]);
28579  goto __pyx_L0;
28580 
28581  /* "View.MemoryView":230
28582  * return memoryview(self, flags, self.dtype_is_object)
28583  *
28584  * def __len__(self): # <<<<<<<<<<<<<<
28585  * return self._shape[0]
28586  *
28587  */
28588 
28589  /* function exit code */
28590  __pyx_L0:;
28591  __Pyx_RefNannyFinishContext();
28592  return __pyx_r;
28593 }
28594 
28595 /* "View.MemoryView":233
28596  * return self._shape[0]
28597  *
28598  * def __getattr__(self, attr): # <<<<<<<<<<<<<<
28599  * return getattr(self.memview, attr)
28600  *
28601  */
28602 
28603 /* Python wrapper */
28604 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/
28605 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
28606  PyObject *__pyx_r = 0;
28607  __Pyx_RefNannyDeclarations
28608  __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
28609  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));
28610 
28611  /* function exit code */
28612  __Pyx_RefNannyFinishContext();
28613  return __pyx_r;
28614 }
28615 
28616 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
28617  PyObject *__pyx_r = NULL;
28618  __Pyx_RefNannyDeclarations
28619  PyObject *__pyx_t_1 = NULL;
28620  PyObject *__pyx_t_2 = NULL;
28621  __Pyx_RefNannySetupContext("__getattr__", 0);
28622 
28623  /* "View.MemoryView":234
28624  *
28625  * def __getattr__(self, attr):
28626  * return getattr(self.memview, attr) # <<<<<<<<<<<<<<
28627  *
28628  * def __getitem__(self, item):
28629  */
28630  __Pyx_XDECREF(__pyx_r);
28631  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 234, __pyx_L1_error)
28632  __Pyx_GOTREF(__pyx_t_1);
28633  __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 234, __pyx_L1_error)
28634  __Pyx_GOTREF(__pyx_t_2);
28635  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
28636  __pyx_r = __pyx_t_2;
28637  __pyx_t_2 = 0;
28638  goto __pyx_L0;
28639 
28640  /* "View.MemoryView":233
28641  * return self._shape[0]
28642  *
28643  * def __getattr__(self, attr): # <<<<<<<<<<<<<<
28644  * return getattr(self.memview, attr)
28645  *
28646  */
28647 
28648  /* function exit code */
28649  __pyx_L1_error:;
28650  __Pyx_XDECREF(__pyx_t_1);
28651  __Pyx_XDECREF(__pyx_t_2);
28652  __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
28653  __pyx_r = NULL;
28654  __pyx_L0:;
28655  __Pyx_XGIVEREF(__pyx_r);
28656  __Pyx_RefNannyFinishContext();
28657  return __pyx_r;
28658 }
28659 
28660 /* "View.MemoryView":236
28661  * return getattr(self.memview, attr)
28662  *
28663  * def __getitem__(self, item): # <<<<<<<<<<<<<<
28664  * return self.memview[item]
28665  *
28666  */
28667 
28668 /* Python wrapper */
28669 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
28670 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
28671  PyObject *__pyx_r = 0;
28672  __Pyx_RefNannyDeclarations
28673  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
28674  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));
28675 
28676  /* function exit code */
28677  __Pyx_RefNannyFinishContext();
28678  return __pyx_r;
28679 }
28680 
28681 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
28682  PyObject *__pyx_r = NULL;
28683  __Pyx_RefNannyDeclarations
28684  PyObject *__pyx_t_1 = NULL;
28685  PyObject *__pyx_t_2 = NULL;
28686  __Pyx_RefNannySetupContext("__getitem__", 0);
28687 
28688  /* "View.MemoryView":237
28689  *
28690  * def __getitem__(self, item):
28691  * return self.memview[item] # <<<<<<<<<<<<<<
28692  *
28693  * def __setitem__(self, item, value):
28694  */
28695  __Pyx_XDECREF(__pyx_r);
28696  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 237, __pyx_L1_error)
28697  __Pyx_GOTREF(__pyx_t_1);
28698  __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 237, __pyx_L1_error)
28699  __Pyx_GOTREF(__pyx_t_2);
28700  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
28701  __pyx_r = __pyx_t_2;
28702  __pyx_t_2 = 0;
28703  goto __pyx_L0;
28704 
28705  /* "View.MemoryView":236
28706  * return getattr(self.memview, attr)
28707  *
28708  * def __getitem__(self, item): # <<<<<<<<<<<<<<
28709  * return self.memview[item]
28710  *
28711  */
28712 
28713  /* function exit code */
28714  __pyx_L1_error:;
28715  __Pyx_XDECREF(__pyx_t_1);
28716  __Pyx_XDECREF(__pyx_t_2);
28717  __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
28718  __pyx_r = NULL;
28719  __pyx_L0:;
28720  __Pyx_XGIVEREF(__pyx_r);
28721  __Pyx_RefNannyFinishContext();
28722  return __pyx_r;
28723 }
28724 
28725 /* "View.MemoryView":239
28726  * return self.memview[item]
28727  *
28728  * def __setitem__(self, item, value): # <<<<<<<<<<<<<<
28729  * self.memview[item] = value
28730  *
28731  */
28732 
28733 /* Python wrapper */
28734 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/
28735 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
28736  int __pyx_r;
28737  __Pyx_RefNannyDeclarations
28738  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
28739  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value));
28740 
28741  /* function exit code */
28742  __Pyx_RefNannyFinishContext();
28743  return __pyx_r;
28744 }
28745 
28746 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
28747  int __pyx_r;
28748  __Pyx_RefNannyDeclarations
28749  PyObject *__pyx_t_1 = NULL;
28750  __Pyx_RefNannySetupContext("__setitem__", 0);
28751 
28752  /* "View.MemoryView":240
28753  *
28754  * def __setitem__(self, item, value):
28755  * self.memview[item] = value # <<<<<<<<<<<<<<
28756  *
28757  *
28758  */
28759  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 240, __pyx_L1_error)
28760  __Pyx_GOTREF(__pyx_t_1);
28761  if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(2, 240, __pyx_L1_error)
28762  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
28763 
28764  /* "View.MemoryView":239
28765  * return self.memview[item]
28766  *
28767  * def __setitem__(self, item, value): # <<<<<<<<<<<<<<
28768  * self.memview[item] = value
28769  *
28770  */
28771 
28772  /* function exit code */
28773  __pyx_r = 0;
28774  goto __pyx_L0;
28775  __pyx_L1_error:;
28776  __Pyx_XDECREF(__pyx_t_1);
28777  __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
28778  __pyx_r = -1;
28779  __pyx_L0:;
28780  __Pyx_RefNannyFinishContext();
28781  return __pyx_r;
28782 }
28783 
28784 /* "(tree fragment)":1
28785  * def __reduce_cython__(self): # <<<<<<<<<<<<<<
28786  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
28787  * def __setstate_cython__(self, __pyx_state):
28788  */
28789 
28790 /* Python wrapper */
28791 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
28792 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
28793  PyObject *__pyx_r = 0;
28794  __Pyx_RefNannyDeclarations
28795  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
28796  __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self));
28797 
28798  /* function exit code */
28799  __Pyx_RefNannyFinishContext();
28800  return __pyx_r;
28801 }
28802 
28803 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) {
28804  PyObject *__pyx_r = NULL;
28805  __Pyx_RefNannyDeclarations
28806  PyObject *__pyx_t_1 = NULL;
28807  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
28808 
28809  /* "(tree fragment)":2
28810  * def __reduce_cython__(self):
28811  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
28812  * def __setstate_cython__(self, __pyx_state):
28813  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
28814  */
28815  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
28816  __Pyx_GOTREF(__pyx_t_1);
28817  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
28818  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
28819  __PYX_ERR(2, 2, __pyx_L1_error)
28820 
28821  /* "(tree fragment)":1
28822  * def __reduce_cython__(self): # <<<<<<<<<<<<<<
28823  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
28824  * def __setstate_cython__(self, __pyx_state):
28825  */
28826 
28827  /* function exit code */
28828  __pyx_L1_error:;
28829  __Pyx_XDECREF(__pyx_t_1);
28830  __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
28831  __pyx_r = NULL;
28832  __Pyx_XGIVEREF(__pyx_r);
28833  __Pyx_RefNannyFinishContext();
28834  return __pyx_r;
28835 }
28836 
28837 /* "(tree fragment)":3
28838  * def __reduce_cython__(self):
28839  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
28840  * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
28841  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
28842  */
28843 
28844 /* Python wrapper */
28845 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
28846 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
28847  PyObject *__pyx_r = 0;
28848  __Pyx_RefNannyDeclarations
28849  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
28850  __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
28851 
28852  /* function exit code */
28853  __Pyx_RefNannyFinishContext();
28854  return __pyx_r;
28855 }
28856 
28857 static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
28858  PyObject *__pyx_r = NULL;
28859  __Pyx_RefNannyDeclarations
28860  PyObject *__pyx_t_1 = NULL;
28861  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
28862 
28863  /* "(tree fragment)":4
28864  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
28865  * def __setstate_cython__(self, __pyx_state):
28866  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
28867  */
28868  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
28869  __Pyx_GOTREF(__pyx_t_1);
28870  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
28871  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
28872  __PYX_ERR(2, 4, __pyx_L1_error)
28873 
28874  /* "(tree fragment)":3
28875  * def __reduce_cython__(self):
28876  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
28877  * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
28878  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
28879  */
28880 
28881  /* function exit code */
28882  __pyx_L1_error:;
28883  __Pyx_XDECREF(__pyx_t_1);
28884  __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
28885  __pyx_r = NULL;
28886  __Pyx_XGIVEREF(__pyx_r);
28887  __Pyx_RefNannyFinishContext();
28888  return __pyx_r;
28889 }
28890 
28891 /* "View.MemoryView":244
28892  *
28893  * @cname("__pyx_array_new")
28894  * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<<
28895  * char *mode, char *buf):
28896  * cdef array result
28897  */
28898 
28899 static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char *__pyx_v_mode, char *__pyx_v_buf) {
28900  struct __pyx_array_obj *__pyx_v_result = 0;
28901  struct __pyx_array_obj *__pyx_r = NULL;
28902  __Pyx_RefNannyDeclarations
28903  int __pyx_t_1;
28904  PyObject *__pyx_t_2 = NULL;
28905  PyObject *__pyx_t_3 = NULL;
28906  PyObject *__pyx_t_4 = NULL;
28907  PyObject *__pyx_t_5 = NULL;
28908  __Pyx_RefNannySetupContext("array_cwrapper", 0);
28909 
28910  /* "View.MemoryView":248
28911  * cdef array result
28912  *
28913  * if buf == NULL: # <<<<<<<<<<<<<<
28914  * result = array(shape, itemsize, format, mode.decode('ASCII'))
28915  * else:
28916  */
28917  __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
28918  if (__pyx_t_1) {
28919 
28920  /* "View.MemoryView":249
28921  *
28922  * if buf == NULL:
28923  * result = array(shape, itemsize, format, mode.decode('ASCII')) # <<<<<<<<<<<<<<
28924  * else:
28925  * result = array(shape, itemsize, format, mode.decode('ASCII'),
28926  */
28927  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 249, __pyx_L1_error)
28928  __Pyx_GOTREF(__pyx_t_2);
28929  __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 249, __pyx_L1_error)
28930  __Pyx_GOTREF(__pyx_t_3);
28931  __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 249, __pyx_L1_error)
28932  __Pyx_GOTREF(__pyx_t_4);
28933  __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 249, __pyx_L1_error)
28934  __Pyx_GOTREF(__pyx_t_5);
28935  __Pyx_INCREF(__pyx_v_shape);
28936  __Pyx_GIVEREF(__pyx_v_shape);
28937  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape);
28938  __Pyx_GIVEREF(__pyx_t_2);
28939  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
28940  __Pyx_GIVEREF(__pyx_t_3);
28941  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
28942  __Pyx_GIVEREF(__pyx_t_4);
28943  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
28944  __pyx_t_2 = 0;
28945  __pyx_t_3 = 0;
28946  __pyx_t_4 = 0;
28947  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 249, __pyx_L1_error)
28948  __Pyx_GOTREF(__pyx_t_4);
28949  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
28950  __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4);
28951  __pyx_t_4 = 0;
28952 
28953  /* "View.MemoryView":248
28954  * cdef array result
28955  *
28956  * if buf == NULL: # <<<<<<<<<<<<<<
28957  * result = array(shape, itemsize, format, mode.decode('ASCII'))
28958  * else:
28959  */
28960  goto __pyx_L3;
28961  }
28962 
28963  /* "View.MemoryView":251
28964  * result = array(shape, itemsize, format, mode.decode('ASCII'))
28965  * else:
28966  * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<<
28967  * allocate_buffer=False)
28968  * result.data = buf
28969  */
28970  /*else*/ {
28971  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 251, __pyx_L1_error)
28972  __Pyx_GOTREF(__pyx_t_4);
28973  __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 251, __pyx_L1_error)
28974  __Pyx_GOTREF(__pyx_t_5);
28975  __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 251, __pyx_L1_error)
28976  __Pyx_GOTREF(__pyx_t_3);
28977  __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 251, __pyx_L1_error)
28978  __Pyx_GOTREF(__pyx_t_2);
28979  __Pyx_INCREF(__pyx_v_shape);
28980  __Pyx_GIVEREF(__pyx_v_shape);
28981  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
28982  __Pyx_GIVEREF(__pyx_t_4);
28983  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
28984  __Pyx_GIVEREF(__pyx_t_5);
28985  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
28986  __Pyx_GIVEREF(__pyx_t_3);
28987  PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
28988  __pyx_t_4 = 0;
28989  __pyx_t_5 = 0;
28990  __pyx_t_3 = 0;
28991 
28992  /* "View.MemoryView":252
28993  * else:
28994  * result = array(shape, itemsize, format, mode.decode('ASCII'),
28995  * allocate_buffer=False) # <<<<<<<<<<<<<<
28996  * result.data = buf
28997  *
28998  */
28999  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 252, __pyx_L1_error)
29000  __Pyx_GOTREF(__pyx_t_3);
29001  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(2, 252, __pyx_L1_error)
29002 
29003  /* "View.MemoryView":251
29004  * result = array(shape, itemsize, format, mode.decode('ASCII'))
29005  * else:
29006  * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<<
29007  * allocate_buffer=False)
29008  * result.data = buf
29009  */
29010  __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 251, __pyx_L1_error)
29011  __Pyx_GOTREF(__pyx_t_5);
29012  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
29013  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
29014  __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5);
29015  __pyx_t_5 = 0;
29016 
29017  /* "View.MemoryView":253
29018  * result = array(shape, itemsize, format, mode.decode('ASCII'),
29019  * allocate_buffer=False)
29020  * result.data = buf # <<<<<<<<<<<<<<
29021  *
29022  * return result
29023  */
29024  __pyx_v_result->data = __pyx_v_buf;
29025  }
29026  __pyx_L3:;
29027 
29028  /* "View.MemoryView":255
29029  * result.data = buf
29030  *
29031  * return result # <<<<<<<<<<<<<<
29032  *
29033  *
29034  */
29035  __Pyx_XDECREF(((PyObject *)__pyx_r));
29036  __Pyx_INCREF(((PyObject *)__pyx_v_result));
29037  __pyx_r = __pyx_v_result;
29038  goto __pyx_L0;
29039 
29040  /* "View.MemoryView":244
29041  *
29042  * @cname("__pyx_array_new")
29043  * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<<
29044  * char *mode, char *buf):
29045  * cdef array result
29046  */
29047 
29048  /* function exit code */
29049  __pyx_L1_error:;
29050  __Pyx_XDECREF(__pyx_t_2);
29051  __Pyx_XDECREF(__pyx_t_3);
29052  __Pyx_XDECREF(__pyx_t_4);
29053  __Pyx_XDECREF(__pyx_t_5);
29054  __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
29055  __pyx_r = 0;
29056  __pyx_L0:;
29057  __Pyx_XDECREF((PyObject *)__pyx_v_result);
29058  __Pyx_XGIVEREF((PyObject *)__pyx_r);
29059  __Pyx_RefNannyFinishContext();
29060  return __pyx_r;
29061 }
29062 
29063 /* "View.MemoryView":281
29064  * cdef class Enum(object):
29065  * cdef object name
29066  * def __init__(self, name): # <<<<<<<<<<<<<<
29067  * self.name = name
29068  * def __repr__(self):
29069  */
29070 
29071 /* Python wrapper */
29072 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
29073 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
29074  PyObject *__pyx_v_name = 0;
29075  int __pyx_r;
29076  __Pyx_RefNannyDeclarations
29077  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
29078  {
29079  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
29080  PyObject* values[1] = {0};
29081  if (unlikely(__pyx_kwds)) {
29082  Py_ssize_t kw_args;
29083  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
29084  switch (pos_args) {
29085  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
29086  CYTHON_FALLTHROUGH;
29087  case 0: break;
29088  default: goto __pyx_L5_argtuple_error;
29089  }
29090  kw_args = PyDict_Size(__pyx_kwds);
29091  switch (pos_args) {
29092  case 0:
29093  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
29094  else goto __pyx_L5_argtuple_error;
29095  }
29096  if (unlikely(kw_args > 0)) {
29097  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(2, 281, __pyx_L3_error)
29098  }
29099  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
29100  goto __pyx_L5_argtuple_error;
29101  } else {
29102  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
29103  }
29104  __pyx_v_name = values[0];
29105  }
29106  goto __pyx_L4_argument_unpacking_done;
29107  __pyx_L5_argtuple_error:;
29108  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 281, __pyx_L3_error)
29109  __pyx_L3_error:;
29110  __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
29111  __Pyx_RefNannyFinishContext();
29112  return -1;
29113  __pyx_L4_argument_unpacking_done:;
29114  __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);
29115 
29116  /* function exit code */
29117  __Pyx_RefNannyFinishContext();
29118  return __pyx_r;
29119 }
29120 
29121 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
29122  int __pyx_r;
29123  __Pyx_RefNannyDeclarations
29124  __Pyx_RefNannySetupContext("__init__", 0);
29125 
29126  /* "View.MemoryView":282
29127  * cdef object name
29128  * def __init__(self, name):
29129  * self.name = name # <<<<<<<<<<<<<<
29130  * def __repr__(self):
29131  * return self.name
29132  */
29133  __Pyx_INCREF(__pyx_v_name);
29134  __Pyx_GIVEREF(__pyx_v_name);
29135  __Pyx_GOTREF(__pyx_v_self->name);
29136  __Pyx_DECREF(__pyx_v_self->name);
29137  __pyx_v_self->name = __pyx_v_name;
29138 
29139  /* "View.MemoryView":281
29140  * cdef class Enum(object):
29141  * cdef object name
29142  * def __init__(self, name): # <<<<<<<<<<<<<<
29143  * self.name = name
29144  * def __repr__(self):
29145  */
29146 
29147  /* function exit code */
29148  __pyx_r = 0;
29149  __Pyx_RefNannyFinishContext();
29150  return __pyx_r;
29151 }
29152 
29153 /* "View.MemoryView":283
29154  * def __init__(self, name):
29155  * self.name = name
29156  * def __repr__(self): # <<<<<<<<<<<<<<
29157  * return self.name
29158  *
29159  */
29160 
29161 /* Python wrapper */
29162 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/
29163 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
29164  PyObject *__pyx_r = 0;
29165  __Pyx_RefNannyDeclarations
29166  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
29167  __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
29168 
29169  /* function exit code */
29170  __Pyx_RefNannyFinishContext();
29171  return __pyx_r;
29172 }
29173 
29174 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
29175  PyObject *__pyx_r = NULL;
29176  __Pyx_RefNannyDeclarations
29177  __Pyx_RefNannySetupContext("__repr__", 0);
29178 
29179  /* "View.MemoryView":284
29180  * self.name = name
29181  * def __repr__(self):
29182  * return self.name # <<<<<<<<<<<<<<
29183  *
29184  * cdef generic = Enum("<strided and direct or indirect>")
29185  */
29186  __Pyx_XDECREF(__pyx_r);
29187  __Pyx_INCREF(__pyx_v_self->name);
29188  __pyx_r = __pyx_v_self->name;
29189  goto __pyx_L0;
29190 
29191  /* "View.MemoryView":283
29192  * def __init__(self, name):
29193  * self.name = name
29194  * def __repr__(self): # <<<<<<<<<<<<<<
29195  * return self.name
29196  *
29197  */
29198 
29199  /* function exit code */
29200  __pyx_L0:;
29201  __Pyx_XGIVEREF(__pyx_r);
29202  __Pyx_RefNannyFinishContext();
29203  return __pyx_r;
29204 }
29205 
29206 /* "(tree fragment)":1
29207  * def __reduce_cython__(self): # <<<<<<<<<<<<<<
29208  * cdef tuple state
29209  * cdef object _dict
29210  */
29211 
29212 /* Python wrapper */
29213 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
29214 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
29215  PyObject *__pyx_r = 0;
29216  __Pyx_RefNannyDeclarations
29217  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
29218  __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
29219 
29220  /* function exit code */
29221  __Pyx_RefNannyFinishContext();
29222  return __pyx_r;
29223 }
29224 
29225 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
29226  PyObject *__pyx_v_state = 0;
29227  PyObject *__pyx_v__dict = 0;
29228  int __pyx_v_use_setstate;
29229  PyObject *__pyx_r = NULL;
29230  __Pyx_RefNannyDeclarations
29231  PyObject *__pyx_t_1 = NULL;
29232  int __pyx_t_2;
29233  int __pyx_t_3;
29234  PyObject *__pyx_t_4 = NULL;
29235  PyObject *__pyx_t_5 = NULL;
29236  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
29237 
29238  /* "(tree fragment)":5
29239  * cdef object _dict
29240  * cdef bint use_setstate
29241  * state = (self.name,) # <<<<<<<<<<<<<<
29242  * _dict = getattr(self, '__dict__', None)
29243  * if _dict is not None:
29244  */
29245  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error)
29246  __Pyx_GOTREF(__pyx_t_1);
29247  __Pyx_INCREF(__pyx_v_self->name);
29248  __Pyx_GIVEREF(__pyx_v_self->name);
29249  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name);
29250  __pyx_v_state = ((PyObject*)__pyx_t_1);
29251  __pyx_t_1 = 0;
29252 
29253  /* "(tree fragment)":6
29254  * cdef bint use_setstate
29255  * state = (self.name,)
29256  * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<<
29257  * if _dict is not None:
29258  * state += (_dict,)
29259  */
29260  __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error)
29261  __Pyx_GOTREF(__pyx_t_1);
29262  __pyx_v__dict = __pyx_t_1;
29263  __pyx_t_1 = 0;
29264 
29265  /* "(tree fragment)":7
29266  * state = (self.name,)
29267  * _dict = getattr(self, '__dict__', None)
29268  * if _dict is not None: # <<<<<<<<<<<<<<
29269  * state += (_dict,)
29270  * use_setstate = True
29271  */
29272  __pyx_t_2 = (__pyx_v__dict != Py_None);
29273  __pyx_t_3 = (__pyx_t_2 != 0);
29274  if (__pyx_t_3) {
29275 
29276  /* "(tree fragment)":8
29277  * _dict = getattr(self, '__dict__', None)
29278  * if _dict is not None:
29279  * state += (_dict,) # <<<<<<<<<<<<<<
29280  * use_setstate = True
29281  * else:
29282  */
29283  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 8, __pyx_L1_error)
29284  __Pyx_GOTREF(__pyx_t_1);
29285  __Pyx_INCREF(__pyx_v__dict);
29286  __Pyx_GIVEREF(__pyx_v__dict);
29287  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
29288  __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 8, __pyx_L1_error)
29289  __Pyx_GOTREF(__pyx_t_4);
29290  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
29291  __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
29292  __pyx_t_4 = 0;
29293 
29294  /* "(tree fragment)":9
29295  * if _dict is not None:
29296  * state += (_dict,)
29297  * use_setstate = True # <<<<<<<<<<<<<<
29298  * else:
29299  * use_setstate = self.name is not None
29300  */
29301  __pyx_v_use_setstate = 1;
29302 
29303  /* "(tree fragment)":7
29304  * state = (self.name,)
29305  * _dict = getattr(self, '__dict__', None)
29306  * if _dict is not None: # <<<<<<<<<<<<<<
29307  * state += (_dict,)
29308  * use_setstate = True
29309  */
29310  goto __pyx_L3;
29311  }
29312 
29313  /* "(tree fragment)":11
29314  * use_setstate = True
29315  * else:
29316  * use_setstate = self.name is not None # <<<<<<<<<<<<<<
29317  * if use_setstate:
29318  * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
29319  */
29320  /*else*/ {
29321  __pyx_t_3 = (__pyx_v_self->name != Py_None);
29322  __pyx_v_use_setstate = __pyx_t_3;
29323  }
29324  __pyx_L3:;
29325 
29326  /* "(tree fragment)":12
29327  * else:
29328  * use_setstate = self.name is not None
29329  * if use_setstate: # <<<<<<<<<<<<<<
29330  * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
29331  * else:
29332  */
29333  __pyx_t_3 = (__pyx_v_use_setstate != 0);
29334  if (__pyx_t_3) {
29335 
29336  /* "(tree fragment)":13
29337  * use_setstate = self.name is not None
29338  * if use_setstate:
29339  * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state # <<<<<<<<<<<<<<
29340  * else:
29341  * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
29342  */
29343  __Pyx_XDECREF(__pyx_r);
29344  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 13, __pyx_L1_error)
29345  __Pyx_GOTREF(__pyx_t_4);
29346  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error)
29347  __Pyx_GOTREF(__pyx_t_1);
29348  __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
29349  __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
29350  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
29351  __Pyx_INCREF(__pyx_int_184977713);
29352  __Pyx_GIVEREF(__pyx_int_184977713);
29353  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
29354  __Pyx_INCREF(Py_None);
29355  __Pyx_GIVEREF(Py_None);
29356  PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
29357  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error)
29358  __Pyx_GOTREF(__pyx_t_5);
29359  __Pyx_GIVEREF(__pyx_t_4);
29360  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
29361  __Pyx_GIVEREF(__pyx_t_1);
29362  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
29363  __Pyx_INCREF(__pyx_v_state);
29364  __Pyx_GIVEREF(__pyx_v_state);
29365  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
29366  __pyx_t_4 = 0;
29367  __pyx_t_1 = 0;
29368  __pyx_r = __pyx_t_5;
29369  __pyx_t_5 = 0;
29370  goto __pyx_L0;
29371 
29372  /* "(tree fragment)":12
29373  * else:
29374  * use_setstate = self.name is not None
29375  * if use_setstate: # <<<<<<<<<<<<<<
29376  * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
29377  * else:
29378  */
29379  }
29380 
29381  /* "(tree fragment)":15
29382  * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
29383  * else:
29384  * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) # <<<<<<<<<<<<<<
29385  * def __setstate_cython__(self, __pyx_state):
29386  * __pyx_unpickle_Enum__set_state(self, __pyx_state)
29387  */
29388  /*else*/ {
29389  __Pyx_XDECREF(__pyx_r);
29390  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 15, __pyx_L1_error)
29391  __Pyx_GOTREF(__pyx_t_5);
29392  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 15, __pyx_L1_error)
29393  __Pyx_GOTREF(__pyx_t_1);
29394  __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
29395  __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
29396  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
29397  __Pyx_INCREF(__pyx_int_184977713);
29398  __Pyx_GIVEREF(__pyx_int_184977713);
29399  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
29400  __Pyx_INCREF(__pyx_v_state);
29401  __Pyx_GIVEREF(__pyx_v_state);
29402  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
29403  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 15, __pyx_L1_error)
29404  __Pyx_GOTREF(__pyx_t_4);
29405  __Pyx_GIVEREF(__pyx_t_5);
29406  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
29407  __Pyx_GIVEREF(__pyx_t_1);
29408  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
29409  __pyx_t_5 = 0;
29410  __pyx_t_1 = 0;
29411  __pyx_r = __pyx_t_4;
29412  __pyx_t_4 = 0;
29413  goto __pyx_L0;
29414  }
29415 
29416  /* "(tree fragment)":1
29417  * def __reduce_cython__(self): # <<<<<<<<<<<<<<
29418  * cdef tuple state
29419  * cdef object _dict
29420  */
29421 
29422  /* function exit code */
29423  __pyx_L1_error:;
29424  __Pyx_XDECREF(__pyx_t_1);
29425  __Pyx_XDECREF(__pyx_t_4);
29426  __Pyx_XDECREF(__pyx_t_5);
29427  __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
29428  __pyx_r = NULL;
29429  __pyx_L0:;
29430  __Pyx_XDECREF(__pyx_v_state);
29431  __Pyx_XDECREF(__pyx_v__dict);
29432  __Pyx_XGIVEREF(__pyx_r);
29433  __Pyx_RefNannyFinishContext();
29434  return __pyx_r;
29435 }
29436 
29437 /* "(tree fragment)":16
29438  * else:
29439  * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
29440  * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
29441  * __pyx_unpickle_Enum__set_state(self, __pyx_state)
29442  */
29443 
29444 /* Python wrapper */
29445 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
29446 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
29447  PyObject *__pyx_r = 0;
29448  __Pyx_RefNannyDeclarations
29449  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
29450  __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
29451 
29452  /* function exit code */
29453  __Pyx_RefNannyFinishContext();
29454  return __pyx_r;
29455 }
29456 
29457 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
29458  PyObject *__pyx_r = NULL;
29459  __Pyx_RefNannyDeclarations
29460  PyObject *__pyx_t_1 = NULL;
29461  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
29462 
29463  /* "(tree fragment)":17
29464  * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
29465  * def __setstate_cython__(self, __pyx_state):
29466  * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<<
29467  */
29468  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 17, __pyx_L1_error)
29469  __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 17, __pyx_L1_error)
29470  __Pyx_GOTREF(__pyx_t_1);
29471  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
29472 
29473  /* "(tree fragment)":16
29474  * else:
29475  * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
29476  * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
29477  * __pyx_unpickle_Enum__set_state(self, __pyx_state)
29478  */
29479 
29480  /* function exit code */
29481  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
29482  goto __pyx_L0;
29483  __pyx_L1_error:;
29484  __Pyx_XDECREF(__pyx_t_1);
29485  __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
29486  __pyx_r = NULL;
29487  __pyx_L0:;
29488  __Pyx_XGIVEREF(__pyx_r);
29489  __Pyx_RefNannyFinishContext();
29490  return __pyx_r;
29491 }
29492 
29493 /* "View.MemoryView":298
29494  *
29495  * @cname('__pyx_align_pointer')
29496  * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<<
29497  * "Align pointer memory on a given boundary"
29498  * cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
29499  */
29500 
29501 static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) {
29502  Py_intptr_t __pyx_v_aligned_p;
29503  size_t __pyx_v_offset;
29504  void *__pyx_r;
29505  int __pyx_t_1;
29506 
29507  /* "View.MemoryView":300
29508  * cdef void *align_pointer(void *memory, size_t alignment) nogil:
29509  * "Align pointer memory on a given boundary"
29510  * cdef Py_intptr_t aligned_p = <Py_intptr_t> memory # <<<<<<<<<<<<<<
29511  * cdef size_t offset
29512  *
29513  */
29514  __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);
29515 
29516  /* "View.MemoryView":304
29517  *
29518  * with cython.cdivision(True):
29519  * offset = aligned_p % alignment # <<<<<<<<<<<<<<
29520  *
29521  * if offset > 0:
29522  */
29523  __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);
29524 
29525  /* "View.MemoryView":306
29526  * offset = aligned_p % alignment
29527  *
29528  * if offset > 0: # <<<<<<<<<<<<<<
29529  * aligned_p += alignment - offset
29530  *
29531  */
29532  __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
29533  if (__pyx_t_1) {
29534 
29535  /* "View.MemoryView":307
29536  *
29537  * if offset > 0:
29538  * aligned_p += alignment - offset # <<<<<<<<<<<<<<
29539  *
29540  * return <void *> aligned_p
29541  */
29542  __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));
29543 
29544  /* "View.MemoryView":306
29545  * offset = aligned_p % alignment
29546  *
29547  * if offset > 0: # <<<<<<<<<<<<<<
29548  * aligned_p += alignment - offset
29549  *
29550  */
29551  }
29552 
29553  /* "View.MemoryView":309
29554  * aligned_p += alignment - offset
29555  *
29556  * return <void *> aligned_p # <<<<<<<<<<<<<<
29557  *
29558  *
29559  */
29560  __pyx_r = ((void *)__pyx_v_aligned_p);
29561  goto __pyx_L0;
29562 
29563  /* "View.MemoryView":298
29564  *
29565  * @cname('__pyx_align_pointer')
29566  * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<<
29567  * "Align pointer memory on a given boundary"
29568  * cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
29569  */
29570 
29571  /* function exit code */
29572  __pyx_L0:;
29573  return __pyx_r;
29574 }
29575 
29576 /* "View.MemoryView":345
29577  * cdef __Pyx_TypeInfo *typeinfo
29578  *
29579  * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<<
29580  * self.obj = obj
29581  * self.flags = flags
29582  */
29583 
29584 /* Python wrapper */
29585 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
29586 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
29587  PyObject *__pyx_v_obj = 0;
29588  int __pyx_v_flags;
29589  int __pyx_v_dtype_is_object;
29590  int __pyx_r;
29591  __Pyx_RefNannyDeclarations
29592  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
29593  {
29594  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0};
29595  PyObject* values[3] = {0,0,0};
29596  if (unlikely(__pyx_kwds)) {
29597  Py_ssize_t kw_args;
29598  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
29599  switch (pos_args) {
29600  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
29601  CYTHON_FALLTHROUGH;
29602  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
29603  CYTHON_FALLTHROUGH;
29604  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
29605  CYTHON_FALLTHROUGH;
29606  case 0: break;
29607  default: goto __pyx_L5_argtuple_error;
29608  }
29609  kw_args = PyDict_Size(__pyx_kwds);
29610  switch (pos_args) {
29611  case 0:
29612  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
29613  else goto __pyx_L5_argtuple_error;
29614  CYTHON_FALLTHROUGH;
29615  case 1:
29616  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
29617  else {
29618  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(2, 345, __pyx_L3_error)
29619  }
29620  CYTHON_FALLTHROUGH;
29621  case 2:
29622  if (kw_args > 0) {
29623  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object);
29624  if (value) { values[2] = value; kw_args--; }
29625  }
29626  }
29627  if (unlikely(kw_args > 0)) {
29628  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 345, __pyx_L3_error)
29629  }
29630  } else {
29631  switch (PyTuple_GET_SIZE(__pyx_args)) {
29632  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
29633  CYTHON_FALLTHROUGH;
29634  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
29635  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
29636  break;
29637  default: goto __pyx_L5_argtuple_error;
29638  }
29639  }
29640  __pyx_v_obj = values[0];
29641  __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 345, __pyx_L3_error)
29642  if (values[2]) {
29643  __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 345, __pyx_L3_error)
29644  } else {
29645  __pyx_v_dtype_is_object = ((int)0);
29646  }
29647  }
29648  goto __pyx_L4_argument_unpacking_done;
29649  __pyx_L5_argtuple_error:;
29650  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 345, __pyx_L3_error)
29651  __pyx_L3_error:;
29652  __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
29653  __Pyx_RefNannyFinishContext();
29654  return -1;
29655  __pyx_L4_argument_unpacking_done:;
29656  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object);
29657 
29658  /* function exit code */
29659  __Pyx_RefNannyFinishContext();
29660  return __pyx_r;
29661 }
29662 
29663 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) {
29664  int __pyx_r;
29665  __Pyx_RefNannyDeclarations
29666  int __pyx_t_1;
29667  int __pyx_t_2;
29668  int __pyx_t_3;
29669  int __pyx_t_4;
29670  __Pyx_RefNannySetupContext("__cinit__", 0);
29671 
29672  /* "View.MemoryView":346
29673  *
29674  * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
29675  * self.obj = obj # <<<<<<<<<<<<<<
29676  * self.flags = flags
29677  * if type(self) is memoryview or obj is not None:
29678  */
29679  __Pyx_INCREF(__pyx_v_obj);
29680  __Pyx_GIVEREF(__pyx_v_obj);
29681  __Pyx_GOTREF(__pyx_v_self->obj);
29682  __Pyx_DECREF(__pyx_v_self->obj);
29683  __pyx_v_self->obj = __pyx_v_obj;
29684 
29685  /* "View.MemoryView":347
29686  * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
29687  * self.obj = obj
29688  * self.flags = flags # <<<<<<<<<<<<<<
29689  * if type(self) is memoryview or obj is not None:
29690  * __Pyx_GetBuffer(obj, &self.view, flags)
29691  */
29692  __pyx_v_self->flags = __pyx_v_flags;
29693 
29694  /* "View.MemoryView":348
29695  * self.obj = obj
29696  * self.flags = flags
29697  * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<<
29698  * __Pyx_GetBuffer(obj, &self.view, flags)
29699  * if <PyObject *> self.view.obj == NULL:
29700  */
29701  __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type));
29702  __pyx_t_3 = (__pyx_t_2 != 0);
29703  if (!__pyx_t_3) {
29704  } else {
29705  __pyx_t_1 = __pyx_t_3;
29706  goto __pyx_L4_bool_binop_done;
29707  }
29708  __pyx_t_3 = (__pyx_v_obj != Py_None);
29709  __pyx_t_2 = (__pyx_t_3 != 0);
29710  __pyx_t_1 = __pyx_t_2;
29711  __pyx_L4_bool_binop_done:;
29712  if (__pyx_t_1) {
29713 
29714  /* "View.MemoryView":349
29715  * self.flags = flags
29716  * if type(self) is memoryview or obj is not None:
29717  * __Pyx_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<<
29718  * if <PyObject *> self.view.obj == NULL:
29719  * (<__pyx_buffer *> &self.view).obj = Py_None
29720  */
29721  __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 349, __pyx_L1_error)
29722 
29723  /* "View.MemoryView":350
29724  * if type(self) is memoryview or obj is not None:
29725  * __Pyx_GetBuffer(obj, &self.view, flags)
29726  * if <PyObject *> self.view.obj == NULL: # <<<<<<<<<<<<<<
29727  * (<__pyx_buffer *> &self.view).obj = Py_None
29728  * Py_INCREF(Py_None)
29729  */
29730  __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
29731  if (__pyx_t_1) {
29732 
29733  /* "View.MemoryView":351
29734  * __Pyx_GetBuffer(obj, &self.view, flags)
29735  * if <PyObject *> self.view.obj == NULL:
29736  * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<<
29737  * Py_INCREF(Py_None)
29738  *
29739  */
29740  ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;
29741 
29742  /* "View.MemoryView":352
29743  * if <PyObject *> self.view.obj == NULL:
29744  * (<__pyx_buffer *> &self.view).obj = Py_None
29745  * Py_INCREF(Py_None) # <<<<<<<<<<<<<<
29746  *
29747  * global __pyx_memoryview_thread_locks_used
29748  */
29749  Py_INCREF(Py_None);
29750 
29751  /* "View.MemoryView":350
29752  * if type(self) is memoryview or obj is not None:
29753  * __Pyx_GetBuffer(obj, &self.view, flags)
29754  * if <PyObject *> self.view.obj == NULL: # <<<<<<<<<<<<<<
29755  * (<__pyx_buffer *> &self.view).obj = Py_None
29756  * Py_INCREF(Py_None)
29757  */
29758  }
29759 
29760  /* "View.MemoryView":348
29761  * self.obj = obj
29762  * self.flags = flags
29763  * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<<
29764  * __Pyx_GetBuffer(obj, &self.view, flags)
29765  * if <PyObject *> self.view.obj == NULL:
29766  */
29767  }
29768 
29769  /* "View.MemoryView":355
29770  *
29771  * global __pyx_memoryview_thread_locks_used
29772  * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<<
29773  * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
29774  * __pyx_memoryview_thread_locks_used += 1
29775  */
29776  __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0);
29777  if (__pyx_t_1) {
29778 
29779  /* "View.MemoryView":356
29780  * global __pyx_memoryview_thread_locks_used
29781  * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
29782  * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<<
29783  * __pyx_memoryview_thread_locks_used += 1
29784  * if self.lock is NULL:
29785  */
29786  __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
29787 
29788  /* "View.MemoryView":357
29789  * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
29790  * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
29791  * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<<
29792  * if self.lock is NULL:
29793  * self.lock = PyThread_allocate_lock()
29794  */
29795  __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);
29796 
29797  /* "View.MemoryView":355
29798  *
29799  * global __pyx_memoryview_thread_locks_used
29800  * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<<
29801  * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
29802  * __pyx_memoryview_thread_locks_used += 1
29803  */
29804  }
29805 
29806  /* "View.MemoryView":358
29807  * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
29808  * __pyx_memoryview_thread_locks_used += 1
29809  * if self.lock is NULL: # <<<<<<<<<<<<<<
29810  * self.lock = PyThread_allocate_lock()
29811  * if self.lock is NULL:
29812  */
29813  __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
29814  if (__pyx_t_1) {
29815 
29816  /* "View.MemoryView":359
29817  * __pyx_memoryview_thread_locks_used += 1
29818  * if self.lock is NULL:
29819  * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<<
29820  * if self.lock is NULL:
29821  * raise MemoryError
29822  */
29823  __pyx_v_self->lock = PyThread_allocate_lock();
29824 
29825  /* "View.MemoryView":360
29826  * if self.lock is NULL:
29827  * self.lock = PyThread_allocate_lock()
29828  * if self.lock is NULL: # <<<<<<<<<<<<<<
29829  * raise MemoryError
29830  *
29831  */
29832  __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
29833  if (unlikely(__pyx_t_1)) {
29834 
29835  /* "View.MemoryView":361
29836  * self.lock = PyThread_allocate_lock()
29837  * if self.lock is NULL:
29838  * raise MemoryError # <<<<<<<<<<<<<<
29839  *
29840  * if flags & PyBUF_FORMAT:
29841  */
29842  PyErr_NoMemory(); __PYX_ERR(2, 361, __pyx_L1_error)
29843 
29844  /* "View.MemoryView":360
29845  * if self.lock is NULL:
29846  * self.lock = PyThread_allocate_lock()
29847  * if self.lock is NULL: # <<<<<<<<<<<<<<
29848  * raise MemoryError
29849  *
29850  */
29851  }
29852 
29853  /* "View.MemoryView":358
29854  * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
29855  * __pyx_memoryview_thread_locks_used += 1
29856  * if self.lock is NULL: # <<<<<<<<<<<<<<
29857  * self.lock = PyThread_allocate_lock()
29858  * if self.lock is NULL:
29859  */
29860  }
29861 
29862  /* "View.MemoryView":363
29863  * raise MemoryError
29864  *
29865  * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
29866  * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
29867  * else:
29868  */
29869  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
29870  if (__pyx_t_1) {
29871 
29872  /* "View.MemoryView":364
29873  *
29874  * if flags & PyBUF_FORMAT:
29875  * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<<
29876  * else:
29877  * self.dtype_is_object = dtype_is_object
29878  */
29879  __pyx_t_2 = (((__pyx_v_self->view.format[0]) == 'O') != 0);
29880  if (__pyx_t_2) {
29881  } else {
29882  __pyx_t_1 = __pyx_t_2;
29883  goto __pyx_L11_bool_binop_done;
29884  }
29885  __pyx_t_2 = (((__pyx_v_self->view.format[1]) == '\x00') != 0);
29886  __pyx_t_1 = __pyx_t_2;
29887  __pyx_L11_bool_binop_done:;
29888  __pyx_v_self->dtype_is_object = __pyx_t_1;
29889 
29890  /* "View.MemoryView":363
29891  * raise MemoryError
29892  *
29893  * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
29894  * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
29895  * else:
29896  */
29897  goto __pyx_L10;
29898  }
29899 
29900  /* "View.MemoryView":366
29901  * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
29902  * else:
29903  * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<<
29904  *
29905  * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
29906  */
29907  /*else*/ {
29908  __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
29909  }
29910  __pyx_L10:;
29911 
29912  /* "View.MemoryView":368
29913  * self.dtype_is_object = dtype_is_object
29914  *
29915  * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( # <<<<<<<<<<<<<<
29916  * <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
29917  * self.typeinfo = NULL
29918  */
29919  __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((void *)(&(__pyx_v_self->acquisition_count[0]))), (sizeof(__pyx_atomic_int))));
29920 
29921  /* "View.MemoryView":370
29922  * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
29923  * <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
29924  * self.typeinfo = NULL # <<<<<<<<<<<<<<
29925  *
29926  * def __dealloc__(memoryview self):
29927  */
29928  __pyx_v_self->typeinfo = NULL;
29929 
29930  /* "View.MemoryView":345
29931  * cdef __Pyx_TypeInfo *typeinfo
29932  *
29933  * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<<
29934  * self.obj = obj
29935  * self.flags = flags
29936  */
29937 
29938  /* function exit code */
29939  __pyx_r = 0;
29940  goto __pyx_L0;
29941  __pyx_L1_error:;
29942  __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
29943  __pyx_r = -1;
29944  __pyx_L0:;
29945  __Pyx_RefNannyFinishContext();
29946  return __pyx_r;
29947 }
29948 
29949 /* "View.MemoryView":372
29950  * self.typeinfo = NULL
29951  *
29952  * def __dealloc__(memoryview self): # <<<<<<<<<<<<<<
29953  * if self.obj is not None:
29954  * __Pyx_ReleaseBuffer(&self.view)
29955  */
29956 
29957 /* Python wrapper */
29958 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/
29959 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
29960  __Pyx_RefNannyDeclarations
29961  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
29962  __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self));
29963 
29964  /* function exit code */
29965  __Pyx_RefNannyFinishContext();
29966 }
29967 
29968 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
29969  int __pyx_v_i;
29970  __Pyx_RefNannyDeclarations
29971  int __pyx_t_1;
29972  int __pyx_t_2;
29973  int __pyx_t_3;
29974  int __pyx_t_4;
29975  int __pyx_t_5;
29976  PyThread_type_lock __pyx_t_6;
29977  PyThread_type_lock __pyx_t_7;
29978  __Pyx_RefNannySetupContext("__dealloc__", 0);
29979 
29980  /* "View.MemoryView":373
29981  *
29982  * def __dealloc__(memoryview self):
29983  * if self.obj is not None: # <<<<<<<<<<<<<<
29984  * __Pyx_ReleaseBuffer(&self.view)
29985  * elif (<__pyx_buffer *> &self.view).obj == Py_None:
29986  */
29987  __pyx_t_1 = (__pyx_v_self->obj != Py_None);
29988  __pyx_t_2 = (__pyx_t_1 != 0);
29989  if (__pyx_t_2) {
29990 
29991  /* "View.MemoryView":374
29992  * def __dealloc__(memoryview self):
29993  * if self.obj is not None:
29994  * __Pyx_ReleaseBuffer(&self.view) # <<<<<<<<<<<<<<
29995  * elif (<__pyx_buffer *> &self.view).obj == Py_None:
29996  *
29997  */
29998  __Pyx_ReleaseBuffer((&__pyx_v_self->view));
29999 
30000  /* "View.MemoryView":373
30001  *
30002  * def __dealloc__(memoryview self):
30003  * if self.obj is not None: # <<<<<<<<<<<<<<
30004  * __Pyx_ReleaseBuffer(&self.view)
30005  * elif (<__pyx_buffer *> &self.view).obj == Py_None:
30006  */
30007  goto __pyx_L3;
30008  }
30009 
30010  /* "View.MemoryView":375
30011  * if self.obj is not None:
30012  * __Pyx_ReleaseBuffer(&self.view)
30013  * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<<
30014  *
30015  * (<__pyx_buffer *> &self.view).obj = NULL
30016  */
30017  __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0);
30018  if (__pyx_t_2) {
30019 
30020  /* "View.MemoryView":377
30021  * elif (<__pyx_buffer *> &self.view).obj == Py_None:
30022  *
30023  * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<<
30024  * Py_DECREF(Py_None)
30025  *
30026  */
30027  ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL;
30028 
30029  /* "View.MemoryView":378
30030  *
30031  * (<__pyx_buffer *> &self.view).obj = NULL
30032  * Py_DECREF(Py_None) # <<<<<<<<<<<<<<
30033  *
30034  * cdef int i
30035  */
30036  Py_DECREF(Py_None);
30037 
30038  /* "View.MemoryView":375
30039  * if self.obj is not None:
30040  * __Pyx_ReleaseBuffer(&self.view)
30041  * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<<
30042  *
30043  * (<__pyx_buffer *> &self.view).obj = NULL
30044  */
30045  }
30046  __pyx_L3:;
30047 
30048  /* "View.MemoryView":382
30049  * cdef int i
30050  * global __pyx_memoryview_thread_locks_used
30051  * if self.lock != NULL: # <<<<<<<<<<<<<<
30052  * for i in range(__pyx_memoryview_thread_locks_used):
30053  * if __pyx_memoryview_thread_locks[i] is self.lock:
30054  */
30055  __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
30056  if (__pyx_t_2) {
30057 
30058  /* "View.MemoryView":383
30059  * global __pyx_memoryview_thread_locks_used
30060  * if self.lock != NULL:
30061  * for i in range(__pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<<
30062  * if __pyx_memoryview_thread_locks[i] is self.lock:
30063  * __pyx_memoryview_thread_locks_used -= 1
30064  */
30065  __pyx_t_3 = __pyx_memoryview_thread_locks_used;
30066  __pyx_t_4 = __pyx_t_3;
30067  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
30068  __pyx_v_i = __pyx_t_5;
30069 
30070  /* "View.MemoryView":384
30071  * if self.lock != NULL:
30072  * for i in range(__pyx_memoryview_thread_locks_used):
30073  * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<<
30074  * __pyx_memoryview_thread_locks_used -= 1
30075  * if i != __pyx_memoryview_thread_locks_used:
30076  */
30077  __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0);
30078  if (__pyx_t_2) {
30079 
30080  /* "View.MemoryView":385
30081  * for i in range(__pyx_memoryview_thread_locks_used):
30082  * if __pyx_memoryview_thread_locks[i] is self.lock:
30083  * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<<
30084  * if i != __pyx_memoryview_thread_locks_used:
30085  * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
30086  */
30087  __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);
30088 
30089  /* "View.MemoryView":386
30090  * if __pyx_memoryview_thread_locks[i] is self.lock:
30091  * __pyx_memoryview_thread_locks_used -= 1
30092  * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<<
30093  * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
30094  * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
30095  */
30096  __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0);
30097  if (__pyx_t_2) {
30098 
30099  /* "View.MemoryView":388
30100  * if i != __pyx_memoryview_thread_locks_used:
30101  * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
30102  * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<<
30103  * break
30104  * else:
30105  */
30106  __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
30107  __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]);
30108 
30109  /* "View.MemoryView":387
30110  * __pyx_memoryview_thread_locks_used -= 1
30111  * if i != __pyx_memoryview_thread_locks_used:
30112  * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<<
30113  * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
30114  * break
30115  */
30116  (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6;
30117  (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7;
30118 
30119  /* "View.MemoryView":386
30120  * if __pyx_memoryview_thread_locks[i] is self.lock:
30121  * __pyx_memoryview_thread_locks_used -= 1
30122  * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<<
30123  * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
30124  * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
30125  */
30126  }
30127 
30128  /* "View.MemoryView":389
30129  * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
30130  * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
30131  * break # <<<<<<<<<<<<<<
30132  * else:
30133  * PyThread_free_lock(self.lock)
30134  */
30135  goto __pyx_L6_break;
30136 
30137  /* "View.MemoryView":384
30138  * if self.lock != NULL:
30139  * for i in range(__pyx_memoryview_thread_locks_used):
30140  * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<<
30141  * __pyx_memoryview_thread_locks_used -= 1
30142  * if i != __pyx_memoryview_thread_locks_used:
30143  */
30144  }
30145  }
30146  /*else*/ {
30147 
30148  /* "View.MemoryView":391
30149  * break
30150  * else:
30151  * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<<
30152  *
30153  * cdef char *get_item_pointer(memoryview self, object index) except NULL:
30154  */
30155  PyThread_free_lock(__pyx_v_self->lock);
30156  }
30157  __pyx_L6_break:;
30158 
30159  /* "View.MemoryView":382
30160  * cdef int i
30161  * global __pyx_memoryview_thread_locks_used
30162  * if self.lock != NULL: # <<<<<<<<<<<<<<
30163  * for i in range(__pyx_memoryview_thread_locks_used):
30164  * if __pyx_memoryview_thread_locks[i] is self.lock:
30165  */
30166  }
30167 
30168  /* "View.MemoryView":372
30169  * self.typeinfo = NULL
30170  *
30171  * def __dealloc__(memoryview self): # <<<<<<<<<<<<<<
30172  * if self.obj is not None:
30173  * __Pyx_ReleaseBuffer(&self.view)
30174  */
30175 
30176  /* function exit code */
30177  __Pyx_RefNannyFinishContext();
30178 }
30179 
30180 /* "View.MemoryView":393
30181  * PyThread_free_lock(self.lock)
30182  *
30183  * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<<
30184  * cdef Py_ssize_t dim
30185  * cdef char *itemp = <char *> self.view.buf
30186  */
30187 
30188 static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
30189  Py_ssize_t __pyx_v_dim;
30190  char *__pyx_v_itemp;
30191  PyObject *__pyx_v_idx = NULL;
30192  char *__pyx_r;
30193  __Pyx_RefNannyDeclarations
30194  Py_ssize_t __pyx_t_1;
30195  PyObject *__pyx_t_2 = NULL;
30196  Py_ssize_t __pyx_t_3;
30197  PyObject *(*__pyx_t_4)(PyObject *);
30198  PyObject *__pyx_t_5 = NULL;
30199  Py_ssize_t __pyx_t_6;
30200  char *__pyx_t_7;
30201  __Pyx_RefNannySetupContext("get_item_pointer", 0);
30202 
30203  /* "View.MemoryView":395
30204  * cdef char *get_item_pointer(memoryview self, object index) except NULL:
30205  * cdef Py_ssize_t dim
30206  * cdef char *itemp = <char *> self.view.buf # <<<<<<<<<<<<<<
30207  *
30208  * for dim, idx in enumerate(index):
30209  */
30210  __pyx_v_itemp = ((char *)__pyx_v_self->view.buf);
30211 
30212  /* "View.MemoryView":397
30213  * cdef char *itemp = <char *> self.view.buf
30214  *
30215  * for dim, idx in enumerate(index): # <<<<<<<<<<<<<<
30216  * itemp = pybuffer_index(&self.view, itemp, idx, dim)
30217  *
30218  */
30219  __pyx_t_1 = 0;
30220  if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
30221  __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
30222  __pyx_t_4 = NULL;
30223  } else {
30224  __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 397, __pyx_L1_error)
30225  __Pyx_GOTREF(__pyx_t_2);
30226  __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 397, __pyx_L1_error)
30227  }
30228  for (;;) {
30229  if (likely(!__pyx_t_4)) {
30230  if (likely(PyList_CheckExact(__pyx_t_2))) {
30231  if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
30232  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
30233  __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 397, __pyx_L1_error)
30234  #else
30235  __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 397, __pyx_L1_error)
30236  __Pyx_GOTREF(__pyx_t_5);
30237  #endif
30238  } else {
30239  if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
30240  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
30241  __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 397, __pyx_L1_error)
30242  #else
30243  __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 397, __pyx_L1_error)
30244  __Pyx_GOTREF(__pyx_t_5);
30245  #endif
30246  }
30247  } else {
30248  __pyx_t_5 = __pyx_t_4(__pyx_t_2);
30249  if (unlikely(!__pyx_t_5)) {
30250  PyObject* exc_type = PyErr_Occurred();
30251  if (exc_type) {
30252  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
30253  else __PYX_ERR(2, 397, __pyx_L1_error)
30254  }
30255  break;
30256  }
30257  __Pyx_GOTREF(__pyx_t_5);
30258  }
30259  __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
30260  __pyx_t_5 = 0;
30261  __pyx_v_dim = __pyx_t_1;
30262  __pyx_t_1 = (__pyx_t_1 + 1);
30263 
30264  /* "View.MemoryView":398
30265  *
30266  * for dim, idx in enumerate(index):
30267  * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<<
30268  *
30269  * return itemp
30270  */
30271  __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 398, __pyx_L1_error)
30272  __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(2, 398, __pyx_L1_error)
30273  __pyx_v_itemp = __pyx_t_7;
30274 
30275  /* "View.MemoryView":397
30276  * cdef char *itemp = <char *> self.view.buf
30277  *
30278  * for dim, idx in enumerate(index): # <<<<<<<<<<<<<<
30279  * itemp = pybuffer_index(&self.view, itemp, idx, dim)
30280  *
30281  */
30282  }
30283  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
30284 
30285  /* "View.MemoryView":400
30286  * itemp = pybuffer_index(&self.view, itemp, idx, dim)
30287  *
30288  * return itemp # <<<<<<<<<<<<<<
30289  *
30290  *
30291  */
30292  __pyx_r = __pyx_v_itemp;
30293  goto __pyx_L0;
30294 
30295  /* "View.MemoryView":393
30296  * PyThread_free_lock(self.lock)
30297  *
30298  * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<<
30299  * cdef Py_ssize_t dim
30300  * cdef char *itemp = <char *> self.view.buf
30301  */
30302 
30303  /* function exit code */
30304  __pyx_L1_error:;
30305  __Pyx_XDECREF(__pyx_t_2);
30306  __Pyx_XDECREF(__pyx_t_5);
30307  __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
30308  __pyx_r = NULL;
30309  __pyx_L0:;
30310  __Pyx_XDECREF(__pyx_v_idx);
30311  __Pyx_RefNannyFinishContext();
30312  return __pyx_r;
30313 }
30314 
30315 /* "View.MemoryView":403
30316  *
30317  *
30318  * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<<
30319  * if index is Ellipsis:
30320  * return self
30321  */
30322 
30323 /* Python wrapper */
30324 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
30325 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
30326  PyObject *__pyx_r = 0;
30327  __Pyx_RefNannyDeclarations
30328  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
30329  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));
30330 
30331  /* function exit code */
30332  __Pyx_RefNannyFinishContext();
30333  return __pyx_r;
30334 }
30335 
30336 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
30337  PyObject *__pyx_v_have_slices = NULL;
30338  PyObject *__pyx_v_indices = NULL;
30339  char *__pyx_v_itemp;
30340  PyObject *__pyx_r = NULL;
30341  __Pyx_RefNannyDeclarations
30342  int __pyx_t_1;
30343  int __pyx_t_2;
30344  PyObject *__pyx_t_3 = NULL;
30345  PyObject *__pyx_t_4 = NULL;
30346  PyObject *__pyx_t_5 = NULL;
30347  char *__pyx_t_6;
30348  __Pyx_RefNannySetupContext("__getitem__", 0);
30349 
30350  /* "View.MemoryView":404
30351  *
30352  * def __getitem__(memoryview self, object index):
30353  * if index is Ellipsis: # <<<<<<<<<<<<<<
30354  * return self
30355  *
30356  */
30357  __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
30358  __pyx_t_2 = (__pyx_t_1 != 0);
30359  if (__pyx_t_2) {
30360 
30361  /* "View.MemoryView":405
30362  * def __getitem__(memoryview self, object index):
30363  * if index is Ellipsis:
30364  * return self # <<<<<<<<<<<<<<
30365  *
30366  * have_slices, indices = _unellipsify(index, self.view.ndim)
30367  */
30368  __Pyx_XDECREF(__pyx_r);
30369  __Pyx_INCREF(((PyObject *)__pyx_v_self));
30370  __pyx_r = ((PyObject *)__pyx_v_self);
30371  goto __pyx_L0;
30372 
30373  /* "View.MemoryView":404
30374  *
30375  * def __getitem__(memoryview self, object index):
30376  * if index is Ellipsis: # <<<<<<<<<<<<<<
30377  * return self
30378  *
30379  */
30380  }
30381 
30382  /* "View.MemoryView":407
30383  * return self
30384  *
30385  * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<<
30386  *
30387  * cdef char *itemp
30388  */
30389  __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 407, __pyx_L1_error)
30390  __Pyx_GOTREF(__pyx_t_3);
30391  if (likely(__pyx_t_3 != Py_None)) {
30392  PyObject* sequence = __pyx_t_3;
30393  Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
30394  if (unlikely(size != 2)) {
30395  if (size > 2) __Pyx_RaiseTooManyValuesError(2);
30396  else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
30397  __PYX_ERR(2, 407, __pyx_L1_error)
30398  }
30399  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
30400  __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
30401  __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
30402  __Pyx_INCREF(__pyx_t_4);
30403  __Pyx_INCREF(__pyx_t_5);
30404  #else
30405  __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 407, __pyx_L1_error)
30406  __Pyx_GOTREF(__pyx_t_4);
30407  __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 407, __pyx_L1_error)
30408  __Pyx_GOTREF(__pyx_t_5);
30409  #endif
30410  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
30411  } else {
30412  __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 407, __pyx_L1_error)
30413  }
30414  __pyx_v_have_slices = __pyx_t_4;
30415  __pyx_t_4 = 0;
30416  __pyx_v_indices = __pyx_t_5;
30417  __pyx_t_5 = 0;
30418 
30419  /* "View.MemoryView":410
30420  *
30421  * cdef char *itemp
30422  * if have_slices: # <<<<<<<<<<<<<<
30423  * return memview_slice(self, indices)
30424  * else:
30425  */
30426  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 410, __pyx_L1_error)
30427  if (__pyx_t_2) {
30428 
30429  /* "View.MemoryView":411
30430  * cdef char *itemp
30431  * if have_slices:
30432  * return memview_slice(self, indices) # <<<<<<<<<<<<<<
30433  * else:
30434  * itemp = self.get_item_pointer(indices)
30435  */
30436  __Pyx_XDECREF(__pyx_r);
30437  __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 411, __pyx_L1_error)
30438  __Pyx_GOTREF(__pyx_t_3);
30439  __pyx_r = __pyx_t_3;
30440  __pyx_t_3 = 0;
30441  goto __pyx_L0;
30442 
30443  /* "View.MemoryView":410
30444  *
30445  * cdef char *itemp
30446  * if have_slices: # <<<<<<<<<<<<<<
30447  * return memview_slice(self, indices)
30448  * else:
30449  */
30450  }
30451 
30452  /* "View.MemoryView":413
30453  * return memview_slice(self, indices)
30454  * else:
30455  * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<<
30456  * return self.convert_item_to_object(itemp)
30457  *
30458  */
30459  /*else*/ {
30460  __pyx_t_6 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_6 == ((char *)NULL))) __PYX_ERR(2, 413, __pyx_L1_error)
30461  __pyx_v_itemp = __pyx_t_6;
30462 
30463  /* "View.MemoryView":414
30464  * else:
30465  * itemp = self.get_item_pointer(indices)
30466  * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<<
30467  *
30468  * def __setitem__(memoryview self, object index, object value):
30469  */
30470  __Pyx_XDECREF(__pyx_r);
30471  __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 414, __pyx_L1_error)
30472  __Pyx_GOTREF(__pyx_t_3);
30473  __pyx_r = __pyx_t_3;
30474  __pyx_t_3 = 0;
30475  goto __pyx_L0;
30476  }
30477 
30478  /* "View.MemoryView":403
30479  *
30480  *
30481  * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<<
30482  * if index is Ellipsis:
30483  * return self
30484  */
30485 
30486  /* function exit code */
30487  __pyx_L1_error:;
30488  __Pyx_XDECREF(__pyx_t_3);
30489  __Pyx_XDECREF(__pyx_t_4);
30490  __Pyx_XDECREF(__pyx_t_5);
30491  __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
30492  __pyx_r = NULL;
30493  __pyx_L0:;
30494  __Pyx_XDECREF(__pyx_v_have_slices);
30495  __Pyx_XDECREF(__pyx_v_indices);
30496  __Pyx_XGIVEREF(__pyx_r);
30497  __Pyx_RefNannyFinishContext();
30498  return __pyx_r;
30499 }
30500 
30501 /* "View.MemoryView":416
30502  * return self.convert_item_to_object(itemp)
30503  *
30504  * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<<
30505  * if self.view.readonly:
30506  * raise TypeError("Cannot assign to read-only memoryview")
30507  */
30508 
30509 /* Python wrapper */
30510 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
30511 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
30512  int __pyx_r;
30513  __Pyx_RefNannyDeclarations
30514  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
30515  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value));
30516 
30517  /* function exit code */
30518  __Pyx_RefNannyFinishContext();
30519  return __pyx_r;
30520 }
30521 
30522 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
30523  PyObject *__pyx_v_have_slices = NULL;
30524  PyObject *__pyx_v_obj = NULL;
30525  int __pyx_r;
30526  __Pyx_RefNannyDeclarations
30527  int __pyx_t_1;
30528  PyObject *__pyx_t_2 = NULL;
30529  PyObject *__pyx_t_3 = NULL;
30530  PyObject *__pyx_t_4 = NULL;
30531  __Pyx_RefNannySetupContext("__setitem__", 0);
30532  __Pyx_INCREF(__pyx_v_index);
30533 
30534  /* "View.MemoryView":417
30535  *
30536  * def __setitem__(memoryview self, object index, object value):
30537  * if self.view.readonly: # <<<<<<<<<<<<<<
30538  * raise TypeError("Cannot assign to read-only memoryview")
30539  *
30540  */
30541  __pyx_t_1 = (__pyx_v_self->view.readonly != 0);
30542  if (unlikely(__pyx_t_1)) {
30543 
30544  /* "View.MemoryView":418
30545  * def __setitem__(memoryview self, object index, object value):
30546  * if self.view.readonly:
30547  * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<<
30548  *
30549  * have_slices, index = _unellipsify(index, self.view.ndim)
30550  */
30551  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 418, __pyx_L1_error)
30552  __Pyx_GOTREF(__pyx_t_2);
30553  __Pyx_Raise(__pyx_t_2, 0, 0, 0);
30554  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
30555  __PYX_ERR(2, 418, __pyx_L1_error)
30556 
30557  /* "View.MemoryView":417
30558  *
30559  * def __setitem__(memoryview self, object index, object value):
30560  * if self.view.readonly: # <<<<<<<<<<<<<<
30561  * raise TypeError("Cannot assign to read-only memoryview")
30562  *
30563  */
30564  }
30565 
30566  /* "View.MemoryView":420
30567  * raise TypeError("Cannot assign to read-only memoryview")
30568  *
30569  * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<<
30570  *
30571  * if have_slices:
30572  */
30573  __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 420, __pyx_L1_error)
30574  __Pyx_GOTREF(__pyx_t_2);
30575  if (likely(__pyx_t_2 != Py_None)) {
30576  PyObject* sequence = __pyx_t_2;
30577  Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
30578  if (unlikely(size != 2)) {
30579  if (size > 2) __Pyx_RaiseTooManyValuesError(2);
30580  else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
30581  __PYX_ERR(2, 420, __pyx_L1_error)
30582  }
30583  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
30584  __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
30585  __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
30586  __Pyx_INCREF(__pyx_t_3);
30587  __Pyx_INCREF(__pyx_t_4);
30588  #else
30589  __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 420, __pyx_L1_error)
30590  __Pyx_GOTREF(__pyx_t_3);
30591  __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 420, __pyx_L1_error)
30592  __Pyx_GOTREF(__pyx_t_4);
30593  #endif
30594  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
30595  } else {
30596  __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 420, __pyx_L1_error)
30597  }
30598  __pyx_v_have_slices = __pyx_t_3;
30599  __pyx_t_3 = 0;
30600  __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4);
30601  __pyx_t_4 = 0;
30602 
30603  /* "View.MemoryView":422
30604  * have_slices, index = _unellipsify(index, self.view.ndim)
30605  *
30606  * if have_slices: # <<<<<<<<<<<<<<
30607  * obj = self.is_slice(value)
30608  * if obj:
30609  */
30610  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 422, __pyx_L1_error)
30611  if (__pyx_t_1) {
30612 
30613  /* "View.MemoryView":423
30614  *
30615  * if have_slices:
30616  * obj = self.is_slice(value) # <<<<<<<<<<<<<<
30617  * if obj:
30618  * self.setitem_slice_assignment(self[index], obj)
30619  */
30620  __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 423, __pyx_L1_error)
30621  __Pyx_GOTREF(__pyx_t_2);
30622  __pyx_v_obj = __pyx_t_2;
30623  __pyx_t_2 = 0;
30624 
30625  /* "View.MemoryView":424
30626  * if have_slices:
30627  * obj = self.is_slice(value)
30628  * if obj: # <<<<<<<<<<<<<<
30629  * self.setitem_slice_assignment(self[index], obj)
30630  * else:
30631  */
30632  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 424, __pyx_L1_error)
30633  if (__pyx_t_1) {
30634 
30635  /* "View.MemoryView":425
30636  * obj = self.is_slice(value)
30637  * if obj:
30638  * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<<
30639  * else:
30640  * self.setitem_slice_assign_scalar(self[index], value)
30641  */
30642  __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 425, __pyx_L1_error)
30643  __Pyx_GOTREF(__pyx_t_2);
30644  __pyx_t_4 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_2, __pyx_v_obj); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 425, __pyx_L1_error)
30645  __Pyx_GOTREF(__pyx_t_4);
30646  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
30647  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
30648 
30649  /* "View.MemoryView":424
30650  * if have_slices:
30651  * obj = self.is_slice(value)
30652  * if obj: # <<<<<<<<<<<<<<
30653  * self.setitem_slice_assignment(self[index], obj)
30654  * else:
30655  */
30656  goto __pyx_L5;
30657  }
30658 
30659  /* "View.MemoryView":427
30660  * self.setitem_slice_assignment(self[index], obj)
30661  * else:
30662  * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<<
30663  * else:
30664  * self.setitem_indexed(index, value)
30665  */
30666  /*else*/ {
30667  __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 427, __pyx_L1_error)
30668  __Pyx_GOTREF(__pyx_t_4);
30669  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(2, 427, __pyx_L1_error)
30670  __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_4), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 427, __pyx_L1_error)
30671  __Pyx_GOTREF(__pyx_t_2);
30672  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
30673  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
30674  }
30675  __pyx_L5:;
30676 
30677  /* "View.MemoryView":422
30678  * have_slices, index = _unellipsify(index, self.view.ndim)
30679  *
30680  * if have_slices: # <<<<<<<<<<<<<<
30681  * obj = self.is_slice(value)
30682  * if obj:
30683  */
30684  goto __pyx_L4;
30685  }
30686 
30687  /* "View.MemoryView":429
30688  * self.setitem_slice_assign_scalar(self[index], value)
30689  * else:
30690  * self.setitem_indexed(index, value) # <<<<<<<<<<<<<<
30691  *
30692  * cdef is_slice(self, obj):
30693  */
30694  /*else*/ {
30695  __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 429, __pyx_L1_error)
30696  __Pyx_GOTREF(__pyx_t_2);
30697  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
30698  }
30699  __pyx_L4:;
30700 
30701  /* "View.MemoryView":416
30702  * return self.convert_item_to_object(itemp)
30703  *
30704  * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<<
30705  * if self.view.readonly:
30706  * raise TypeError("Cannot assign to read-only memoryview")
30707  */
30708 
30709  /* function exit code */
30710  __pyx_r = 0;
30711  goto __pyx_L0;
30712  __pyx_L1_error:;
30713  __Pyx_XDECREF(__pyx_t_2);
30714  __Pyx_XDECREF(__pyx_t_3);
30715  __Pyx_XDECREF(__pyx_t_4);
30716  __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
30717  __pyx_r = -1;
30718  __pyx_L0:;
30719  __Pyx_XDECREF(__pyx_v_have_slices);
30720  __Pyx_XDECREF(__pyx_v_obj);
30721  __Pyx_XDECREF(__pyx_v_index);
30722  __Pyx_RefNannyFinishContext();
30723  return __pyx_r;
30724 }
30725 
30726 /* "View.MemoryView":431
30727  * self.setitem_indexed(index, value)
30728  *
30729  * cdef is_slice(self, obj): # <<<<<<<<<<<<<<
30730  * if not isinstance(obj, memoryview):
30731  * try:
30732  */
30733 
30734 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
30735  PyObject *__pyx_r = NULL;
30736  __Pyx_RefNannyDeclarations
30737  int __pyx_t_1;
30738  int __pyx_t_2;
30739  PyObject *__pyx_t_3 = NULL;
30740  PyObject *__pyx_t_4 = NULL;
30741  PyObject *__pyx_t_5 = NULL;
30742  PyObject *__pyx_t_6 = NULL;
30743  PyObject *__pyx_t_7 = NULL;
30744  PyObject *__pyx_t_8 = NULL;
30745  int __pyx_t_9;
30746  __Pyx_RefNannySetupContext("is_slice", 0);
30747  __Pyx_INCREF(__pyx_v_obj);
30748 
30749  /* "View.MemoryView":432
30750  *
30751  * cdef is_slice(self, obj):
30752  * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<<
30753  * try:
30754  * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
30755  */
30756  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type);
30757  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
30758  if (__pyx_t_2) {
30759 
30760  /* "View.MemoryView":433
30761  * cdef is_slice(self, obj):
30762  * if not isinstance(obj, memoryview):
30763  * try: # <<<<<<<<<<<<<<
30764  * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
30765  * self.dtype_is_object)
30766  */
30767  {
30768  __Pyx_PyThreadState_declare
30769  __Pyx_PyThreadState_assign
30770  __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
30771  __Pyx_XGOTREF(__pyx_t_3);
30772  __Pyx_XGOTREF(__pyx_t_4);
30773  __Pyx_XGOTREF(__pyx_t_5);
30774  /*try:*/ {
30775 
30776  /* "View.MemoryView":434
30777  * if not isinstance(obj, memoryview):
30778  * try:
30779  * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<<
30780  * self.dtype_is_object)
30781  * except TypeError:
30782  */
30783  __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 434, __pyx_L4_error)
30784  __Pyx_GOTREF(__pyx_t_6);
30785 
30786  /* "View.MemoryView":435
30787  * try:
30788  * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
30789  * self.dtype_is_object) # <<<<<<<<<<<<<<
30790  * except TypeError:
30791  * return None
30792  */
30793  __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 435, __pyx_L4_error)
30794  __Pyx_GOTREF(__pyx_t_7);
30795 
30796  /* "View.MemoryView":434
30797  * if not isinstance(obj, memoryview):
30798  * try:
30799  * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<<
30800  * self.dtype_is_object)
30801  * except TypeError:
30802  */
30803  __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 434, __pyx_L4_error)
30804  __Pyx_GOTREF(__pyx_t_8);
30805  __Pyx_INCREF(__pyx_v_obj);
30806  __Pyx_GIVEREF(__pyx_v_obj);
30807  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
30808  __Pyx_GIVEREF(__pyx_t_6);
30809  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
30810  __Pyx_GIVEREF(__pyx_t_7);
30811  PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
30812  __pyx_t_6 = 0;
30813  __pyx_t_7 = 0;
30814  __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 434, __pyx_L4_error)
30815  __Pyx_GOTREF(__pyx_t_7);
30816  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
30817  __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
30818  __pyx_t_7 = 0;
30819 
30820  /* "View.MemoryView":433
30821  * cdef is_slice(self, obj):
30822  * if not isinstance(obj, memoryview):
30823  * try: # <<<<<<<<<<<<<<
30824  * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
30825  * self.dtype_is_object)
30826  */
30827  }
30828  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
30829  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
30830  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
30831  goto __pyx_L9_try_end;
30832  __pyx_L4_error:;
30833  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
30834  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
30835  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
30836 
30837  /* "View.MemoryView":436
30838  * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
30839  * self.dtype_is_object)
30840  * except TypeError: # <<<<<<<<<<<<<<
30841  * return None
30842  *
30843  */
30844  __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
30845  if (__pyx_t_9) {
30846  __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
30847  if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(2, 436, __pyx_L6_except_error)
30848  __Pyx_GOTREF(__pyx_t_7);
30849  __Pyx_GOTREF(__pyx_t_8);
30850  __Pyx_GOTREF(__pyx_t_6);
30851 
30852  /* "View.MemoryView":437
30853  * self.dtype_is_object)
30854  * except TypeError:
30855  * return None # <<<<<<<<<<<<<<
30856  *
30857  * return obj
30858  */
30859  __Pyx_XDECREF(__pyx_r);
30860  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
30861  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
30862  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
30863  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
30864  goto __pyx_L7_except_return;
30865  }
30866  goto __pyx_L6_except_error;
30867  __pyx_L6_except_error:;
30868 
30869  /* "View.MemoryView":433
30870  * cdef is_slice(self, obj):
30871  * if not isinstance(obj, memoryview):
30872  * try: # <<<<<<<<<<<<<<
30873  * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
30874  * self.dtype_is_object)
30875  */
30876  __Pyx_XGIVEREF(__pyx_t_3);
30877  __Pyx_XGIVEREF(__pyx_t_4);
30878  __Pyx_XGIVEREF(__pyx_t_5);
30879  __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
30880  goto __pyx_L1_error;
30881  __pyx_L7_except_return:;
30882  __Pyx_XGIVEREF(__pyx_t_3);
30883  __Pyx_XGIVEREF(__pyx_t_4);
30884  __Pyx_XGIVEREF(__pyx_t_5);
30885  __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
30886  goto __pyx_L0;
30887  __pyx_L9_try_end:;
30888  }
30889 
30890  /* "View.MemoryView":432
30891  *
30892  * cdef is_slice(self, obj):
30893  * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<<
30894  * try:
30895  * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
30896  */
30897  }
30898 
30899  /* "View.MemoryView":439
30900  * return None
30901  *
30902  * return obj # <<<<<<<<<<<<<<
30903  *
30904  * cdef setitem_slice_assignment(self, dst, src):
30905  */
30906  __Pyx_XDECREF(__pyx_r);
30907  __Pyx_INCREF(__pyx_v_obj);
30908  __pyx_r = __pyx_v_obj;
30909  goto __pyx_L0;
30910 
30911  /* "View.MemoryView":431
30912  * self.setitem_indexed(index, value)
30913  *
30914  * cdef is_slice(self, obj): # <<<<<<<<<<<<<<
30915  * if not isinstance(obj, memoryview):
30916  * try:
30917  */
30918 
30919  /* function exit code */
30920  __pyx_L1_error:;
30921  __Pyx_XDECREF(__pyx_t_6);
30922  __Pyx_XDECREF(__pyx_t_7);
30923  __Pyx_XDECREF(__pyx_t_8);
30924  __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
30925  __pyx_r = 0;
30926  __pyx_L0:;
30927  __Pyx_XDECREF(__pyx_v_obj);
30928  __Pyx_XGIVEREF(__pyx_r);
30929  __Pyx_RefNannyFinishContext();
30930  return __pyx_r;
30931 }
30932 
30933 /* "View.MemoryView":441
30934  * return obj
30935  *
30936  * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<<
30937  * cdef __Pyx_memviewslice dst_slice
30938  * cdef __Pyx_memviewslice src_slice
30939  */
30940 
30941 static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
30942  __Pyx_memviewslice __pyx_v_dst_slice;
30943  __Pyx_memviewslice __pyx_v_src_slice;
30944  PyObject *__pyx_r = NULL;
30945  __Pyx_RefNannyDeclarations
30946  __Pyx_memviewslice *__pyx_t_1;
30947  __Pyx_memviewslice *__pyx_t_2;
30948  PyObject *__pyx_t_3 = NULL;
30949  int __pyx_t_4;
30950  int __pyx_t_5;
30951  int __pyx_t_6;
30952  __Pyx_RefNannySetupContext("setitem_slice_assignment", 0);
30953 
30954  /* "View.MemoryView":445
30955  * cdef __Pyx_memviewslice src_slice
30956  *
30957  * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<<
30958  * get_slice_from_memview(dst, &dst_slice)[0],
30959  * src.ndim, dst.ndim, self.dtype_is_object)
30960  */
30961  if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(2, 445, __pyx_L1_error)
30962  __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 445, __pyx_L1_error)
30963 
30964  /* "View.MemoryView":446
30965  *
30966  * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
30967  * get_slice_from_memview(dst, &dst_slice)[0], # <<<<<<<<<<<<<<
30968  * src.ndim, dst.ndim, self.dtype_is_object)
30969  *
30970  */
30971  if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(2, 446, __pyx_L1_error)
30972  __pyx_t_2 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_2 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 446, __pyx_L1_error)
30973 
30974  /* "View.MemoryView":447
30975  * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
30976  * get_slice_from_memview(dst, &dst_slice)[0],
30977  * src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<<
30978  *
30979  * cdef setitem_slice_assign_scalar(self, memoryview dst, value):
30980  */
30981  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 447, __pyx_L1_error)
30982  __Pyx_GOTREF(__pyx_t_3);
30983  __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 447, __pyx_L1_error)
30984  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
30985  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 447, __pyx_L1_error)
30986  __Pyx_GOTREF(__pyx_t_3);
30987  __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 447, __pyx_L1_error)
30988  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
30989 
30990  /* "View.MemoryView":445
30991  * cdef __Pyx_memviewslice src_slice
30992  *
30993  * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<<
30994  * get_slice_from_memview(dst, &dst_slice)[0],
30995  * src.ndim, dst.ndim, self.dtype_is_object)
30996  */
30997  __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_t_1[0]), (__pyx_t_2[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 445, __pyx_L1_error)
30998 
30999  /* "View.MemoryView":441
31000  * return obj
31001  *
31002  * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<<
31003  * cdef __Pyx_memviewslice dst_slice
31004  * cdef __Pyx_memviewslice src_slice
31005  */
31006 
31007  /* function exit code */
31008  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
31009  goto __pyx_L0;
31010  __pyx_L1_error:;
31011  __Pyx_XDECREF(__pyx_t_3);
31012  __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
31013  __pyx_r = 0;
31014  __pyx_L0:;
31015  __Pyx_XGIVEREF(__pyx_r);
31016  __Pyx_RefNannyFinishContext();
31017  return __pyx_r;
31018 }
31019 
31020 /* "View.MemoryView":449
31021  * src.ndim, dst.ndim, self.dtype_is_object)
31022  *
31023  * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<<
31024  * cdef int array[128]
31025  * cdef void *tmp = NULL
31026  */
31027 
31028 static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) {
31029  int __pyx_v_array[0x80];
31030  void *__pyx_v_tmp;
31031  void *__pyx_v_item;
31032  __Pyx_memviewslice *__pyx_v_dst_slice;
31033  __Pyx_memviewslice __pyx_v_tmp_slice;
31034  PyObject *__pyx_r = NULL;
31035  __Pyx_RefNannyDeclarations
31036  __Pyx_memviewslice *__pyx_t_1;
31037  int __pyx_t_2;
31038  PyObject *__pyx_t_3 = NULL;
31039  int __pyx_t_4;
31040  int __pyx_t_5;
31041  char const *__pyx_t_6;
31042  PyObject *__pyx_t_7 = NULL;
31043  PyObject *__pyx_t_8 = NULL;
31044  PyObject *__pyx_t_9 = NULL;
31045  PyObject *__pyx_t_10 = NULL;
31046  PyObject *__pyx_t_11 = NULL;
31047  PyObject *__pyx_t_12 = NULL;
31048  __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0);
31049 
31050  /* "View.MemoryView":451
31051  * cdef setitem_slice_assign_scalar(self, memoryview dst, value):
31052  * cdef int array[128]
31053  * cdef void *tmp = NULL # <<<<<<<<<<<<<<
31054  * cdef void *item
31055  *
31056  */
31057  __pyx_v_tmp = NULL;
31058 
31059  /* "View.MemoryView":456
31060  * cdef __Pyx_memviewslice *dst_slice
31061  * cdef __Pyx_memviewslice tmp_slice
31062  * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<<
31063  *
31064  * if <size_t>self.view.itemsize > sizeof(array):
31065  */
31066  __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 456, __pyx_L1_error)
31067  __pyx_v_dst_slice = __pyx_t_1;
31068 
31069  /* "View.MemoryView":458
31070  * dst_slice = get_slice_from_memview(dst, &tmp_slice)
31071  *
31072  * if <size_t>self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<<
31073  * tmp = PyMem_Malloc(self.view.itemsize)
31074  * if tmp == NULL:
31075  */
31076  __pyx_t_2 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0);
31077  if (__pyx_t_2) {
31078 
31079  /* "View.MemoryView":459
31080  *
31081  * if <size_t>self.view.itemsize > sizeof(array):
31082  * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<<
31083  * if tmp == NULL:
31084  * raise MemoryError
31085  */
31086  __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);
31087 
31088  /* "View.MemoryView":460
31089  * if <size_t>self.view.itemsize > sizeof(array):
31090  * tmp = PyMem_Malloc(self.view.itemsize)
31091  * if tmp == NULL: # <<<<<<<<<<<<<<
31092  * raise MemoryError
31093  * item = tmp
31094  */
31095  __pyx_t_2 = ((__pyx_v_tmp == NULL) != 0);
31096  if (unlikely(__pyx_t_2)) {
31097 
31098  /* "View.MemoryView":461
31099  * tmp = PyMem_Malloc(self.view.itemsize)
31100  * if tmp == NULL:
31101  * raise MemoryError # <<<<<<<<<<<<<<
31102  * item = tmp
31103  * else:
31104  */
31105  PyErr_NoMemory(); __PYX_ERR(2, 461, __pyx_L1_error)
31106 
31107  /* "View.MemoryView":460
31108  * if <size_t>self.view.itemsize > sizeof(array):
31109  * tmp = PyMem_Malloc(self.view.itemsize)
31110  * if tmp == NULL: # <<<<<<<<<<<<<<
31111  * raise MemoryError
31112  * item = tmp
31113  */
31114  }
31115 
31116  /* "View.MemoryView":462
31117  * if tmp == NULL:
31118  * raise MemoryError
31119  * item = tmp # <<<<<<<<<<<<<<
31120  * else:
31121  * item = <void *> array
31122  */
31123  __pyx_v_item = __pyx_v_tmp;
31124 
31125  /* "View.MemoryView":458
31126  * dst_slice = get_slice_from_memview(dst, &tmp_slice)
31127  *
31128  * if <size_t>self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<<
31129  * tmp = PyMem_Malloc(self.view.itemsize)
31130  * if tmp == NULL:
31131  */
31132  goto __pyx_L3;
31133  }
31134 
31135  /* "View.MemoryView":464
31136  * item = tmp
31137  * else:
31138  * item = <void *> array # <<<<<<<<<<<<<<
31139  *
31140  * try:
31141  */
31142  /*else*/ {
31143  __pyx_v_item = ((void *)__pyx_v_array);
31144  }
31145  __pyx_L3:;
31146 
31147  /* "View.MemoryView":466
31148  * item = <void *> array
31149  *
31150  * try: # <<<<<<<<<<<<<<
31151  * if self.dtype_is_object:
31152  * (<PyObject **> item)[0] = <PyObject *> value
31153  */
31154  /*try:*/ {
31155 
31156  /* "View.MemoryView":467
31157  *
31158  * try:
31159  * if self.dtype_is_object: # <<<<<<<<<<<<<<
31160  * (<PyObject **> item)[0] = <PyObject *> value
31161  * else:
31162  */
31163  __pyx_t_2 = (__pyx_v_self->dtype_is_object != 0);
31164  if (__pyx_t_2) {
31165 
31166  /* "View.MemoryView":468
31167  * try:
31168  * if self.dtype_is_object:
31169  * (<PyObject **> item)[0] = <PyObject *> value # <<<<<<<<<<<<<<
31170  * else:
31171  * self.assign_item_from_object(<char *> item, value)
31172  */
31173  (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);
31174 
31175  /* "View.MemoryView":467
31176  *
31177  * try:
31178  * if self.dtype_is_object: # <<<<<<<<<<<<<<
31179  * (<PyObject **> item)[0] = <PyObject *> value
31180  * else:
31181  */
31182  goto __pyx_L8;
31183  }
31184 
31185  /* "View.MemoryView":470
31186  * (<PyObject **> item)[0] = <PyObject *> value
31187  * else:
31188  * self.assign_item_from_object(<char *> item, value) # <<<<<<<<<<<<<<
31189  *
31190  *
31191  */
31192  /*else*/ {
31193  __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 470, __pyx_L6_error)
31194  __Pyx_GOTREF(__pyx_t_3);
31195  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
31196  }
31197  __pyx_L8:;
31198 
31199  /* "View.MemoryView":474
31200  *
31201  *
31202  * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<<
31203  * assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
31204  * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
31205  */
31206  __pyx_t_2 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
31207  if (__pyx_t_2) {
31208 
31209  /* "View.MemoryView":475
31210  *
31211  * if self.view.suboffsets != NULL:
31212  * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<<
31213  * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
31214  * item, self.dtype_is_object)
31215  */
31216  __pyx_t_3 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 475, __pyx_L6_error)
31217  __Pyx_GOTREF(__pyx_t_3);
31218  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
31219 
31220  /* "View.MemoryView":474
31221  *
31222  *
31223  * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<<
31224  * assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
31225  * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
31226  */
31227  }
31228 
31229  /* "View.MemoryView":476
31230  * if self.view.suboffsets != NULL:
31231  * assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
31232  * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<<
31233  * item, self.dtype_is_object)
31234  * finally:
31235  */
31236  __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object);
31237  }
31238 
31239  /* "View.MemoryView":479
31240  * item, self.dtype_is_object)
31241  * finally:
31242  * PyMem_Free(tmp) # <<<<<<<<<<<<<<
31243  *
31244  * cdef setitem_indexed(self, index, value):
31245  */
31246  /*finally:*/ {
31247  /*normal exit:*/{
31248  PyMem_Free(__pyx_v_tmp);
31249  goto __pyx_L7;
31250  }
31251  __pyx_L6_error:;
31252  /*exception exit:*/{
31253  __Pyx_PyThreadState_declare
31254  __Pyx_PyThreadState_assign
31255  __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
31256  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
31257  if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
31258  if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
31259  __Pyx_XGOTREF(__pyx_t_7);
31260  __Pyx_XGOTREF(__pyx_t_8);
31261  __Pyx_XGOTREF(__pyx_t_9);
31262  __Pyx_XGOTREF(__pyx_t_10);
31263  __Pyx_XGOTREF(__pyx_t_11);
31264  __Pyx_XGOTREF(__pyx_t_12);
31265  __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
31266  {
31267  PyMem_Free(__pyx_v_tmp);
31268  }
31269  if (PY_MAJOR_VERSION >= 3) {
31270  __Pyx_XGIVEREF(__pyx_t_10);
31271  __Pyx_XGIVEREF(__pyx_t_11);
31272  __Pyx_XGIVEREF(__pyx_t_12);
31273  __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
31274  }
31275  __Pyx_XGIVEREF(__pyx_t_7);
31276  __Pyx_XGIVEREF(__pyx_t_8);
31277  __Pyx_XGIVEREF(__pyx_t_9);
31278  __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
31279  __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
31280  __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
31281  goto __pyx_L1_error;
31282  }
31283  __pyx_L7:;
31284  }
31285 
31286  /* "View.MemoryView":449
31287  * src.ndim, dst.ndim, self.dtype_is_object)
31288  *
31289  * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<<
31290  * cdef int array[128]
31291  * cdef void *tmp = NULL
31292  */
31293 
31294  /* function exit code */
31295  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
31296  goto __pyx_L0;
31297  __pyx_L1_error:;
31298  __Pyx_XDECREF(__pyx_t_3);
31299  __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
31300  __pyx_r = 0;
31301  __pyx_L0:;
31302  __Pyx_XGIVEREF(__pyx_r);
31303  __Pyx_RefNannyFinishContext();
31304  return __pyx_r;
31305 }
31306 
31307 /* "View.MemoryView":481
31308  * PyMem_Free(tmp)
31309  *
31310  * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<<
31311  * cdef char *itemp = self.get_item_pointer(index)
31312  * self.assign_item_from_object(itemp, value)
31313  */
31314 
31315 static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
31316  char *__pyx_v_itemp;
31317  PyObject *__pyx_r = NULL;
31318  __Pyx_RefNannyDeclarations
31319  char *__pyx_t_1;
31320  PyObject *__pyx_t_2 = NULL;
31321  __Pyx_RefNannySetupContext("setitem_indexed", 0);
31322 
31323  /* "View.MemoryView":482
31324  *
31325  * cdef setitem_indexed(self, index, value):
31326  * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<<
31327  * self.assign_item_from_object(itemp, value)
31328  *
31329  */
31330  __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(2, 482, __pyx_L1_error)
31331  __pyx_v_itemp = __pyx_t_1;
31332 
31333  /* "View.MemoryView":483
31334  * cdef setitem_indexed(self, index, value):
31335  * cdef char *itemp = self.get_item_pointer(index)
31336  * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<<
31337  *
31338  * cdef convert_item_to_object(self, char *itemp):
31339  */
31340  __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 483, __pyx_L1_error)
31341  __Pyx_GOTREF(__pyx_t_2);
31342  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
31343 
31344  /* "View.MemoryView":481
31345  * PyMem_Free(tmp)
31346  *
31347  * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<<
31348  * cdef char *itemp = self.get_item_pointer(index)
31349  * self.assign_item_from_object(itemp, value)
31350  */
31351 
31352  /* function exit code */
31353  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
31354  goto __pyx_L0;
31355  __pyx_L1_error:;
31356  __Pyx_XDECREF(__pyx_t_2);
31357  __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
31358  __pyx_r = 0;
31359  __pyx_L0:;
31360  __Pyx_XGIVEREF(__pyx_r);
31361  __Pyx_RefNannyFinishContext();
31362  return __pyx_r;
31363 }
31364 
31365 /* "View.MemoryView":485
31366  * self.assign_item_from_object(itemp, value)
31367  *
31368  * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
31369  * """Only used if instantiated manually by the user, or if Cython doesn't
31370  * know how to convert the type"""
31371  */
31372 
31373 static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) {
31374  PyObject *__pyx_v_struct = NULL;
31375  PyObject *__pyx_v_bytesitem = 0;
31376  PyObject *__pyx_v_result = NULL;
31377  PyObject *__pyx_r = NULL;
31378  __Pyx_RefNannyDeclarations
31379  PyObject *__pyx_t_1 = NULL;
31380  PyObject *__pyx_t_2 = NULL;
31381  PyObject *__pyx_t_3 = NULL;
31382  PyObject *__pyx_t_4 = NULL;
31383  PyObject *__pyx_t_5 = NULL;
31384  PyObject *__pyx_t_6 = NULL;
31385  PyObject *__pyx_t_7 = NULL;
31386  int __pyx_t_8;
31387  PyObject *__pyx_t_9 = NULL;
31388  size_t __pyx_t_10;
31389  int __pyx_t_11;
31390  __Pyx_RefNannySetupContext("convert_item_to_object", 0);
31391 
31392  /* "View.MemoryView":488
31393  * """Only used if instantiated manually by the user, or if Cython doesn't
31394  * know how to convert the type"""
31395  * import struct # <<<<<<<<<<<<<<
31396  * cdef bytes bytesitem
31397  *
31398  */
31399  __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 488, __pyx_L1_error)
31400  __Pyx_GOTREF(__pyx_t_1);
31401  __pyx_v_struct = __pyx_t_1;
31402  __pyx_t_1 = 0;
31403 
31404  /* "View.MemoryView":491
31405  * cdef bytes bytesitem
31406  *
31407  * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<<
31408  * try:
31409  * result = struct.unpack(self.view.format, bytesitem)
31410  */
31411  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 491, __pyx_L1_error)
31412  __Pyx_GOTREF(__pyx_t_1);
31413  __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
31414  __pyx_t_1 = 0;
31415 
31416  /* "View.MemoryView":492
31417  *
31418  * bytesitem = itemp[:self.view.itemsize]
31419  * try: # <<<<<<<<<<<<<<
31420  * result = struct.unpack(self.view.format, bytesitem)
31421  * except struct.error:
31422  */
31423  {
31424  __Pyx_PyThreadState_declare
31425  __Pyx_PyThreadState_assign
31426  __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
31427  __Pyx_XGOTREF(__pyx_t_2);
31428  __Pyx_XGOTREF(__pyx_t_3);
31429  __Pyx_XGOTREF(__pyx_t_4);
31430  /*try:*/ {
31431 
31432  /* "View.MemoryView":493
31433  * bytesitem = itemp[:self.view.itemsize]
31434  * try:
31435  * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<<
31436  * except struct.error:
31437  * raise ValueError("Unable to convert item to object")
31438  */
31439  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 493, __pyx_L3_error)
31440  __Pyx_GOTREF(__pyx_t_5);
31441  __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 493, __pyx_L3_error)
31442  __Pyx_GOTREF(__pyx_t_6);
31443  __pyx_t_7 = NULL;
31444  __pyx_t_8 = 0;
31445  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
31446  __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
31447  if (likely(__pyx_t_7)) {
31448  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
31449  __Pyx_INCREF(__pyx_t_7);
31450  __Pyx_INCREF(function);
31451  __Pyx_DECREF_SET(__pyx_t_5, function);
31452  __pyx_t_8 = 1;
31453  }
31454  }
31455  #if CYTHON_FAST_PYCALL
31456  if (PyFunction_Check(__pyx_t_5)) {
31457  PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
31458  __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L3_error)
31459  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
31460  __Pyx_GOTREF(__pyx_t_1);
31461  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
31462  } else
31463  #endif
31464  #if CYTHON_FAST_PYCCALL
31465  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
31466  PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
31467  __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L3_error)
31468  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
31469  __Pyx_GOTREF(__pyx_t_1);
31470  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
31471  } else
31472  #endif
31473  {
31474  __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 493, __pyx_L3_error)
31475  __Pyx_GOTREF(__pyx_t_9);
31476  if (__pyx_t_7) {
31477  __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
31478  }
31479  __Pyx_GIVEREF(__pyx_t_6);
31480  PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
31481  __Pyx_INCREF(__pyx_v_bytesitem);
31482  __Pyx_GIVEREF(__pyx_v_bytesitem);
31483  PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem);
31484  __pyx_t_6 = 0;
31485  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L3_error)
31486  __Pyx_GOTREF(__pyx_t_1);
31487  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
31488  }
31489  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
31490  __pyx_v_result = __pyx_t_1;
31491  __pyx_t_1 = 0;
31492 
31493  /* "View.MemoryView":492
31494  *
31495  * bytesitem = itemp[:self.view.itemsize]
31496  * try: # <<<<<<<<<<<<<<
31497  * result = struct.unpack(self.view.format, bytesitem)
31498  * except struct.error:
31499  */
31500  }
31501 
31502  /* "View.MemoryView":497
31503  * raise ValueError("Unable to convert item to object")
31504  * else:
31505  * if len(self.view.format) == 1: # <<<<<<<<<<<<<<
31506  * return result[0]
31507  * return result
31508  */
31509  /*else:*/ {
31510  __pyx_t_10 = strlen(__pyx_v_self->view.format);
31511  __pyx_t_11 = ((__pyx_t_10 == 1) != 0);
31512  if (__pyx_t_11) {
31513 
31514  /* "View.MemoryView":498
31515  * else:
31516  * if len(self.view.format) == 1:
31517  * return result[0] # <<<<<<<<<<<<<<
31518  * return result
31519  *
31520  */
31521  __Pyx_XDECREF(__pyx_r);
31522  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 498, __pyx_L5_except_error)
31523  __Pyx_GOTREF(__pyx_t_1);
31524  __pyx_r = __pyx_t_1;
31525  __pyx_t_1 = 0;
31526  goto __pyx_L6_except_return;
31527 
31528  /* "View.MemoryView":497
31529  * raise ValueError("Unable to convert item to object")
31530  * else:
31531  * if len(self.view.format) == 1: # <<<<<<<<<<<<<<
31532  * return result[0]
31533  * return result
31534  */
31535  }
31536 
31537  /* "View.MemoryView":499
31538  * if len(self.view.format) == 1:
31539  * return result[0]
31540  * return result # <<<<<<<<<<<<<<
31541  *
31542  * cdef assign_item_from_object(self, char *itemp, object value):
31543  */
31544  __Pyx_XDECREF(__pyx_r);
31545  __Pyx_INCREF(__pyx_v_result);
31546  __pyx_r = __pyx_v_result;
31547  goto __pyx_L6_except_return;
31548  }
31549  __pyx_L3_error:;
31550  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
31551  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
31552  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
31553  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
31554  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
31555 
31556  /* "View.MemoryView":494
31557  * try:
31558  * result = struct.unpack(self.view.format, bytesitem)
31559  * except struct.error: # <<<<<<<<<<<<<<
31560  * raise ValueError("Unable to convert item to object")
31561  * else:
31562  */
31563  __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9);
31564  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 494, __pyx_L5_except_error)
31565  __Pyx_GOTREF(__pyx_t_6);
31566  __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
31567  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
31568  __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9);
31569  __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0;
31570  if (__pyx_t_8) {
31571  __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
31572  if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(2, 494, __pyx_L5_except_error)
31573  __Pyx_GOTREF(__pyx_t_9);
31574  __Pyx_GOTREF(__pyx_t_5);
31575  __Pyx_GOTREF(__pyx_t_1);
31576 
31577  /* "View.MemoryView":495
31578  * result = struct.unpack(self.view.format, bytesitem)
31579  * except struct.error:
31580  * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<<
31581  * else:
31582  * if len(self.view.format) == 1:
31583  */
31584  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 495, __pyx_L5_except_error)
31585  __Pyx_GOTREF(__pyx_t_6);
31586  __Pyx_Raise(__pyx_t_6, 0, 0, 0);
31587  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
31588  __PYX_ERR(2, 495, __pyx_L5_except_error)
31589  }
31590  goto __pyx_L5_except_error;
31591  __pyx_L5_except_error:;
31592 
31593  /* "View.MemoryView":492
31594  *
31595  * bytesitem = itemp[:self.view.itemsize]
31596  * try: # <<<<<<<<<<<<<<
31597  * result = struct.unpack(self.view.format, bytesitem)
31598  * except struct.error:
31599  */
31600  __Pyx_XGIVEREF(__pyx_t_2);
31601  __Pyx_XGIVEREF(__pyx_t_3);
31602  __Pyx_XGIVEREF(__pyx_t_4);
31603  __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
31604  goto __pyx_L1_error;
31605  __pyx_L6_except_return:;
31606  __Pyx_XGIVEREF(__pyx_t_2);
31607  __Pyx_XGIVEREF(__pyx_t_3);
31608  __Pyx_XGIVEREF(__pyx_t_4);
31609  __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
31610  goto __pyx_L0;
31611  }
31612 
31613  /* "View.MemoryView":485
31614  * self.assign_item_from_object(itemp, value)
31615  *
31616  * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
31617  * """Only used if instantiated manually by the user, or if Cython doesn't
31618  * know how to convert the type"""
31619  */
31620 
31621  /* function exit code */
31622  __pyx_L1_error:;
31623  __Pyx_XDECREF(__pyx_t_1);
31624  __Pyx_XDECREF(__pyx_t_5);
31625  __Pyx_XDECREF(__pyx_t_6);
31626  __Pyx_XDECREF(__pyx_t_7);
31627  __Pyx_XDECREF(__pyx_t_9);
31628  __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
31629  __pyx_r = 0;
31630  __pyx_L0:;
31631  __Pyx_XDECREF(__pyx_v_struct);
31632  __Pyx_XDECREF(__pyx_v_bytesitem);
31633  __Pyx_XDECREF(__pyx_v_result);
31634  __Pyx_XGIVEREF(__pyx_r);
31635  __Pyx_RefNannyFinishContext();
31636  return __pyx_r;
31637 }
31638 
31639 /* "View.MemoryView":501
31640  * return result
31641  *
31642  * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
31643  * """Only used if instantiated manually by the user, or if Cython doesn't
31644  * know how to convert the type"""
31645  */
31646 
31647 static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
31648  PyObject *__pyx_v_struct = NULL;
31649  char __pyx_v_c;
31650  PyObject *__pyx_v_bytesvalue = 0;
31651  Py_ssize_t __pyx_v_i;
31652  PyObject *__pyx_r = NULL;
31653  __Pyx_RefNannyDeclarations
31654  PyObject *__pyx_t_1 = NULL;
31655  int __pyx_t_2;
31656  int __pyx_t_3;
31657  PyObject *__pyx_t_4 = NULL;
31658  PyObject *__pyx_t_5 = NULL;
31659  PyObject *__pyx_t_6 = NULL;
31660  int __pyx_t_7;
31661  PyObject *__pyx_t_8 = NULL;
31662  Py_ssize_t __pyx_t_9;
31663  PyObject *__pyx_t_10 = NULL;
31664  char *__pyx_t_11;
31665  char *__pyx_t_12;
31666  char *__pyx_t_13;
31667  char *__pyx_t_14;
31668  __Pyx_RefNannySetupContext("assign_item_from_object", 0);
31669 
31670  /* "View.MemoryView":504
31671  * """Only used if instantiated manually by the user, or if Cython doesn't
31672  * know how to convert the type"""
31673  * import struct # <<<<<<<<<<<<<<
31674  * cdef char c
31675  * cdef bytes bytesvalue
31676  */
31677  __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 504, __pyx_L1_error)
31678  __Pyx_GOTREF(__pyx_t_1);
31679  __pyx_v_struct = __pyx_t_1;
31680  __pyx_t_1 = 0;
31681 
31682  /* "View.MemoryView":509
31683  * cdef Py_ssize_t i
31684  *
31685  * if isinstance(value, tuple): # <<<<<<<<<<<<<<
31686  * bytesvalue = struct.pack(self.view.format, *value)
31687  * else:
31688  */
31689  __pyx_t_2 = PyTuple_Check(__pyx_v_value);
31690  __pyx_t_3 = (__pyx_t_2 != 0);
31691  if (__pyx_t_3) {
31692 
31693  /* "View.MemoryView":510
31694  *
31695  * if isinstance(value, tuple):
31696  * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<<
31697  * else:
31698  * bytesvalue = struct.pack(self.view.format, value)
31699  */
31700  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 510, __pyx_L1_error)
31701  __Pyx_GOTREF(__pyx_t_1);
31702  __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error)
31703  __Pyx_GOTREF(__pyx_t_4);
31704  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 510, __pyx_L1_error)
31705  __Pyx_GOTREF(__pyx_t_5);
31706  __Pyx_GIVEREF(__pyx_t_4);
31707  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
31708  __pyx_t_4 = 0;
31709  __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error)
31710  __Pyx_GOTREF(__pyx_t_4);
31711  __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 510, __pyx_L1_error)
31712  __Pyx_GOTREF(__pyx_t_6);
31713  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
31714  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
31715  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error)
31716  __Pyx_GOTREF(__pyx_t_4);
31717  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31718  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
31719  if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 510, __pyx_L1_error)
31720  __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
31721  __pyx_t_4 = 0;
31722 
31723  /* "View.MemoryView":509
31724  * cdef Py_ssize_t i
31725  *
31726  * if isinstance(value, tuple): # <<<<<<<<<<<<<<
31727  * bytesvalue = struct.pack(self.view.format, *value)
31728  * else:
31729  */
31730  goto __pyx_L3;
31731  }
31732 
31733  /* "View.MemoryView":512
31734  * bytesvalue = struct.pack(self.view.format, *value)
31735  * else:
31736  * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<<
31737  *
31738  * for i, c in enumerate(bytesvalue):
31739  */
31740  /*else*/ {
31741  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 512, __pyx_L1_error)
31742  __Pyx_GOTREF(__pyx_t_6);
31743  __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 512, __pyx_L1_error)
31744  __Pyx_GOTREF(__pyx_t_1);
31745  __pyx_t_5 = NULL;
31746  __pyx_t_7 = 0;
31747  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
31748  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
31749  if (likely(__pyx_t_5)) {
31750  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
31751  __Pyx_INCREF(__pyx_t_5);
31752  __Pyx_INCREF(function);
31753  __Pyx_DECREF_SET(__pyx_t_6, function);
31754  __pyx_t_7 = 1;
31755  }
31756  }
31757  #if CYTHON_FAST_PYCALL
31758  if (PyFunction_Check(__pyx_t_6)) {
31759  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
31760  __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error)
31761  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
31762  __Pyx_GOTREF(__pyx_t_4);
31763  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31764  } else
31765  #endif
31766  #if CYTHON_FAST_PYCCALL
31767  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
31768  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
31769  __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error)
31770  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
31771  __Pyx_GOTREF(__pyx_t_4);
31772  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31773  } else
31774  #endif
31775  {
31776  __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 512, __pyx_L1_error)
31777  __Pyx_GOTREF(__pyx_t_8);
31778  if (__pyx_t_5) {
31779  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
31780  }
31781  __Pyx_GIVEREF(__pyx_t_1);
31782  PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1);
31783  __Pyx_INCREF(__pyx_v_value);
31784  __Pyx_GIVEREF(__pyx_v_value);
31785  PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
31786  __pyx_t_1 = 0;
31787  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error)
31788  __Pyx_GOTREF(__pyx_t_4);
31789  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
31790  }
31791  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
31792  if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 512, __pyx_L1_error)
31793  __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
31794  __pyx_t_4 = 0;
31795  }
31796  __pyx_L3:;
31797 
31798  /* "View.MemoryView":514
31799  * bytesvalue = struct.pack(self.view.format, value)
31800  *
31801  * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<<
31802  * itemp[i] = c
31803  *
31804  */
31805  __pyx_t_9 = 0;
31806  if (unlikely(__pyx_v_bytesvalue == Py_None)) {
31807  PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
31808  __PYX_ERR(2, 514, __pyx_L1_error)
31809  }
31810  __Pyx_INCREF(__pyx_v_bytesvalue);
31811  __pyx_t_10 = __pyx_v_bytesvalue;
31812  __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10);
31813  __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10));
31814  for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
31815  __pyx_t_11 = __pyx_t_14;
31816  __pyx_v_c = (__pyx_t_11[0]);
31817 
31818  /* "View.MemoryView":515
31819  *
31820  * for i, c in enumerate(bytesvalue):
31821  * itemp[i] = c # <<<<<<<<<<<<<<
31822  *
31823  * @cname('getbuffer')
31824  */
31825  __pyx_v_i = __pyx_t_9;
31826 
31827  /* "View.MemoryView":514
31828  * bytesvalue = struct.pack(self.view.format, value)
31829  *
31830  * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<<
31831  * itemp[i] = c
31832  *
31833  */
31834  __pyx_t_9 = (__pyx_t_9 + 1);
31835 
31836  /* "View.MemoryView":515
31837  *
31838  * for i, c in enumerate(bytesvalue):
31839  * itemp[i] = c # <<<<<<<<<<<<<<
31840  *
31841  * @cname('getbuffer')
31842  */
31843  (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
31844  }
31845  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
31846 
31847  /* "View.MemoryView":501
31848  * return result
31849  *
31850  * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
31851  * """Only used if instantiated manually by the user, or if Cython doesn't
31852  * know how to convert the type"""
31853  */
31854 
31855  /* function exit code */
31856  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
31857  goto __pyx_L0;
31858  __pyx_L1_error:;
31859  __Pyx_XDECREF(__pyx_t_1);
31860  __Pyx_XDECREF(__pyx_t_4);
31861  __Pyx_XDECREF(__pyx_t_5);
31862  __Pyx_XDECREF(__pyx_t_6);
31863  __Pyx_XDECREF(__pyx_t_8);
31864  __Pyx_XDECREF(__pyx_t_10);
31865  __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
31866  __pyx_r = 0;
31867  __pyx_L0:;
31868  __Pyx_XDECREF(__pyx_v_struct);
31869  __Pyx_XDECREF(__pyx_v_bytesvalue);
31870  __Pyx_XGIVEREF(__pyx_r);
31871  __Pyx_RefNannyFinishContext();
31872  return __pyx_r;
31873 }
31874 
31875 /* "View.MemoryView":518
31876  *
31877  * @cname('getbuffer')
31878  * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
31879  * if flags & PyBUF_WRITABLE and self.view.readonly:
31880  * raise ValueError("Cannot create writable memory view from read-only memoryview")
31881  */
31882 
31883 /* Python wrapper */
31884 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
31885 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
31886  int __pyx_r;
31887  __Pyx_RefNannyDeclarations
31888  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
31889  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
31890 
31891  /* function exit code */
31892  __Pyx_RefNannyFinishContext();
31893  return __pyx_r;
31894 }
31895 
31896 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
31897  int __pyx_r;
31898  __Pyx_RefNannyDeclarations
31899  int __pyx_t_1;
31900  int __pyx_t_2;
31901  PyObject *__pyx_t_3 = NULL;
31902  Py_ssize_t *__pyx_t_4;
31903  char *__pyx_t_5;
31904  void *__pyx_t_6;
31905  int __pyx_t_7;
31906  Py_ssize_t __pyx_t_8;
31907  if (__pyx_v_info == NULL) {
31908  PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
31909  return -1;
31910  }
31911  __Pyx_RefNannySetupContext("__getbuffer__", 0);
31912  __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
31913  __Pyx_GIVEREF(__pyx_v_info->obj);
31914 
31915  /* "View.MemoryView":519
31916  * @cname('getbuffer')
31917  * def __getbuffer__(self, Py_buffer *info, int flags):
31918  * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<<
31919  * raise ValueError("Cannot create writable memory view from read-only memoryview")
31920  *
31921  */
31922  __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
31923  if (__pyx_t_2) {
31924  } else {
31925  __pyx_t_1 = __pyx_t_2;
31926  goto __pyx_L4_bool_binop_done;
31927  }
31928  __pyx_t_2 = (__pyx_v_self->view.readonly != 0);
31929  __pyx_t_1 = __pyx_t_2;
31930  __pyx_L4_bool_binop_done:;
31931  if (unlikely(__pyx_t_1)) {
31932 
31933  /* "View.MemoryView":520
31934  * def __getbuffer__(self, Py_buffer *info, int flags):
31935  * if flags & PyBUF_WRITABLE and self.view.readonly:
31936  * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<<
31937  *
31938  * if flags & PyBUF_ND:
31939  */
31940  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 520, __pyx_L1_error)
31941  __Pyx_GOTREF(__pyx_t_3);
31942  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
31943  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
31944  __PYX_ERR(2, 520, __pyx_L1_error)
31945 
31946  /* "View.MemoryView":519
31947  * @cname('getbuffer')
31948  * def __getbuffer__(self, Py_buffer *info, int flags):
31949  * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<<
31950  * raise ValueError("Cannot create writable memory view from read-only memoryview")
31951  *
31952  */
31953  }
31954 
31955  /* "View.MemoryView":522
31956  * raise ValueError("Cannot create writable memory view from read-only memoryview")
31957  *
31958  * if flags & PyBUF_ND: # <<<<<<<<<<<<<<
31959  * info.shape = self.view.shape
31960  * else:
31961  */
31962  __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
31963  if (__pyx_t_1) {
31964 
31965  /* "View.MemoryView":523
31966  *
31967  * if flags & PyBUF_ND:
31968  * info.shape = self.view.shape # <<<<<<<<<<<<<<
31969  * else:
31970  * info.shape = NULL
31971  */
31972  __pyx_t_4 = __pyx_v_self->view.shape;
31973  __pyx_v_info->shape = __pyx_t_4;
31974 
31975  /* "View.MemoryView":522
31976  * raise ValueError("Cannot create writable memory view from read-only memoryview")
31977  *
31978  * if flags & PyBUF_ND: # <<<<<<<<<<<<<<
31979  * info.shape = self.view.shape
31980  * else:
31981  */
31982  goto __pyx_L6;
31983  }
31984 
31985  /* "View.MemoryView":525
31986  * info.shape = self.view.shape
31987  * else:
31988  * info.shape = NULL # <<<<<<<<<<<<<<
31989  *
31990  * if flags & PyBUF_STRIDES:
31991  */
31992  /*else*/ {
31993  __pyx_v_info->shape = NULL;
31994  }
31995  __pyx_L6:;
31996 
31997  /* "View.MemoryView":527
31998  * info.shape = NULL
31999  *
32000  * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<<
32001  * info.strides = self.view.strides
32002  * else:
32003  */
32004  __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
32005  if (__pyx_t_1) {
32006 
32007  /* "View.MemoryView":528
32008  *
32009  * if flags & PyBUF_STRIDES:
32010  * info.strides = self.view.strides # <<<<<<<<<<<<<<
32011  * else:
32012  * info.strides = NULL
32013  */
32014  __pyx_t_4 = __pyx_v_self->view.strides;
32015  __pyx_v_info->strides = __pyx_t_4;
32016 
32017  /* "View.MemoryView":527
32018  * info.shape = NULL
32019  *
32020  * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<<
32021  * info.strides = self.view.strides
32022  * else:
32023  */
32024  goto __pyx_L7;
32025  }
32026 
32027  /* "View.MemoryView":530
32028  * info.strides = self.view.strides
32029  * else:
32030  * info.strides = NULL # <<<<<<<<<<<<<<
32031  *
32032  * if flags & PyBUF_INDIRECT:
32033  */
32034  /*else*/ {
32035  __pyx_v_info->strides = NULL;
32036  }
32037  __pyx_L7:;
32038 
32039  /* "View.MemoryView":532
32040  * info.strides = NULL
32041  *
32042  * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<<
32043  * info.suboffsets = self.view.suboffsets
32044  * else:
32045  */
32046  __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
32047  if (__pyx_t_1) {
32048 
32049  /* "View.MemoryView":533
32050  *
32051  * if flags & PyBUF_INDIRECT:
32052  * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<<
32053  * else:
32054  * info.suboffsets = NULL
32055  */
32056  __pyx_t_4 = __pyx_v_self->view.suboffsets;
32057  __pyx_v_info->suboffsets = __pyx_t_4;
32058 
32059  /* "View.MemoryView":532
32060  * info.strides = NULL
32061  *
32062  * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<<
32063  * info.suboffsets = self.view.suboffsets
32064  * else:
32065  */
32066  goto __pyx_L8;
32067  }
32068 
32069  /* "View.MemoryView":535
32070  * info.suboffsets = self.view.suboffsets
32071  * else:
32072  * info.suboffsets = NULL # <<<<<<<<<<<<<<
32073  *
32074  * if flags & PyBUF_FORMAT:
32075  */
32076  /*else*/ {
32077  __pyx_v_info->suboffsets = NULL;
32078  }
32079  __pyx_L8:;
32080 
32081  /* "View.MemoryView":537
32082  * info.suboffsets = NULL
32083  *
32084  * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
32085  * info.format = self.view.format
32086  * else:
32087  */
32088  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
32089  if (__pyx_t_1) {
32090 
32091  /* "View.MemoryView":538
32092  *
32093  * if flags & PyBUF_FORMAT:
32094  * info.format = self.view.format # <<<<<<<<<<<<<<
32095  * else:
32096  * info.format = NULL
32097  */
32098  __pyx_t_5 = __pyx_v_self->view.format;
32099  __pyx_v_info->format = __pyx_t_5;
32100 
32101  /* "View.MemoryView":537
32102  * info.suboffsets = NULL
32103  *
32104  * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
32105  * info.format = self.view.format
32106  * else:
32107  */
32108  goto __pyx_L9;
32109  }
32110 
32111  /* "View.MemoryView":540
32112  * info.format = self.view.format
32113  * else:
32114  * info.format = NULL # <<<<<<<<<<<<<<
32115  *
32116  * info.buf = self.view.buf
32117  */
32118  /*else*/ {
32119  __pyx_v_info->format = NULL;
32120  }
32121  __pyx_L9:;
32122 
32123  /* "View.MemoryView":542
32124  * info.format = NULL
32125  *
32126  * info.buf = self.view.buf # <<<<<<<<<<<<<<
32127  * info.ndim = self.view.ndim
32128  * info.itemsize = self.view.itemsize
32129  */
32130  __pyx_t_6 = __pyx_v_self->view.buf;
32131  __pyx_v_info->buf = __pyx_t_6;
32132 
32133  /* "View.MemoryView":543
32134  *
32135  * info.buf = self.view.buf
32136  * info.ndim = self.view.ndim # <<<<<<<<<<<<<<
32137  * info.itemsize = self.view.itemsize
32138  * info.len = self.view.len
32139  */
32140  __pyx_t_7 = __pyx_v_self->view.ndim;
32141  __pyx_v_info->ndim = __pyx_t_7;
32142 
32143  /* "View.MemoryView":544
32144  * info.buf = self.view.buf
32145  * info.ndim = self.view.ndim
32146  * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<<
32147  * info.len = self.view.len
32148  * info.readonly = self.view.readonly
32149  */
32150  __pyx_t_8 = __pyx_v_self->view.itemsize;
32151  __pyx_v_info->itemsize = __pyx_t_8;
32152 
32153  /* "View.MemoryView":545
32154  * info.ndim = self.view.ndim
32155  * info.itemsize = self.view.itemsize
32156  * info.len = self.view.len # <<<<<<<<<<<<<<
32157  * info.readonly = self.view.readonly
32158  * info.obj = self
32159  */
32160  __pyx_t_8 = __pyx_v_self->view.len;
32161  __pyx_v_info->len = __pyx_t_8;
32162 
32163  /* "View.MemoryView":546
32164  * info.itemsize = self.view.itemsize
32165  * info.len = self.view.len
32166  * info.readonly = self.view.readonly # <<<<<<<<<<<<<<
32167  * info.obj = self
32168  *
32169  */
32170  __pyx_t_1 = __pyx_v_self->view.readonly;
32171  __pyx_v_info->readonly = __pyx_t_1;
32172 
32173  /* "View.MemoryView":547
32174  * info.len = self.view.len
32175  * info.readonly = self.view.readonly
32176  * info.obj = self # <<<<<<<<<<<<<<
32177  *
32178  * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
32179  */
32180  __Pyx_INCREF(((PyObject *)__pyx_v_self));
32181  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
32182  __Pyx_GOTREF(__pyx_v_info->obj);
32183  __Pyx_DECREF(__pyx_v_info->obj);
32184  __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
32185 
32186  /* "View.MemoryView":518
32187  *
32188  * @cname('getbuffer')
32189  * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
32190  * if flags & PyBUF_WRITABLE and self.view.readonly:
32191  * raise ValueError("Cannot create writable memory view from read-only memoryview")
32192  */
32193 
32194  /* function exit code */
32195  __pyx_r = 0;
32196  goto __pyx_L0;
32197  __pyx_L1_error:;
32198  __Pyx_XDECREF(__pyx_t_3);
32199  __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
32200  __pyx_r = -1;
32201  if (__pyx_v_info->obj != NULL) {
32202  __Pyx_GOTREF(__pyx_v_info->obj);
32203  __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
32204  }
32205  goto __pyx_L2;
32206  __pyx_L0:;
32207  if (__pyx_v_info->obj == Py_None) {
32208  __Pyx_GOTREF(__pyx_v_info->obj);
32209  __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
32210  }
32211  __pyx_L2:;
32212  __Pyx_RefNannyFinishContext();
32213  return __pyx_r;
32214 }
32215 
32216 /* "View.MemoryView":553
32217  *
32218  * @property
32219  * def T(self): # <<<<<<<<<<<<<<
32220  * cdef _memoryviewslice result = memoryview_copy(self)
32221  * transpose_memslice(&result.from_slice)
32222  */
32223 
32224 /* Python wrapper */
32225 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/
32226 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
32227  PyObject *__pyx_r = 0;
32228  __Pyx_RefNannyDeclarations
32229  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
32230  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
32231 
32232  /* function exit code */
32233  __Pyx_RefNannyFinishContext();
32234  return __pyx_r;
32235 }
32236 
32237 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
32238  struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
32239  PyObject *__pyx_r = NULL;
32240  __Pyx_RefNannyDeclarations
32241  PyObject *__pyx_t_1 = NULL;
32242  int __pyx_t_2;
32243  __Pyx_RefNannySetupContext("__get__", 0);
32244 
32245  /* "View.MemoryView":554
32246  * @property
32247  * def T(self):
32248  * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<<
32249  * transpose_memslice(&result.from_slice)
32250  * return result
32251  */
32252  __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 554, __pyx_L1_error)
32253  __Pyx_GOTREF(__pyx_t_1);
32254  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(2, 554, __pyx_L1_error)
32255  __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1);
32256  __pyx_t_1 = 0;
32257 
32258  /* "View.MemoryView":555
32259  * def T(self):
32260  * cdef _memoryviewslice result = memoryview_copy(self)
32261  * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<<
32262  * return result
32263  *
32264  */
32265  __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 555, __pyx_L1_error)
32266 
32267  /* "View.MemoryView":556
32268  * cdef _memoryviewslice result = memoryview_copy(self)
32269  * transpose_memslice(&result.from_slice)
32270  * return result # <<<<<<<<<<<<<<
32271  *
32272  * @property
32273  */
32274  __Pyx_XDECREF(__pyx_r);
32275  __Pyx_INCREF(((PyObject *)__pyx_v_result));
32276  __pyx_r = ((PyObject *)__pyx_v_result);
32277  goto __pyx_L0;
32278 
32279  /* "View.MemoryView":553
32280  *
32281  * @property
32282  * def T(self): # <<<<<<<<<<<<<<
32283  * cdef _memoryviewslice result = memoryview_copy(self)
32284  * transpose_memslice(&result.from_slice)
32285  */
32286 
32287  /* function exit code */
32288  __pyx_L1_error:;
32289  __Pyx_XDECREF(__pyx_t_1);
32290  __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
32291  __pyx_r = NULL;
32292  __pyx_L0:;
32293  __Pyx_XDECREF((PyObject *)__pyx_v_result);
32294  __Pyx_XGIVEREF(__pyx_r);
32295  __Pyx_RefNannyFinishContext();
32296  return __pyx_r;
32297 }
32298 
32299 /* "View.MemoryView":559
32300  *
32301  * @property
32302  * def base(self): # <<<<<<<<<<<<<<
32303  * return self.obj
32304  *
32305  */
32306 
32307 /* Python wrapper */
32308 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
32309 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
32310  PyObject *__pyx_r = 0;
32311  __Pyx_RefNannyDeclarations
32312  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
32313  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
32314 
32315  /* function exit code */
32316  __Pyx_RefNannyFinishContext();
32317  return __pyx_r;
32318 }
32319 
32320 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
32321  PyObject *__pyx_r = NULL;
32322  __Pyx_RefNannyDeclarations
32323  __Pyx_RefNannySetupContext("__get__", 0);
32324 
32325  /* "View.MemoryView":560
32326  * @property
32327  * def base(self):
32328  * return self.obj # <<<<<<<<<<<<<<
32329  *
32330  * @property
32331  */
32332  __Pyx_XDECREF(__pyx_r);
32333  __Pyx_INCREF(__pyx_v_self->obj);
32334  __pyx_r = __pyx_v_self->obj;
32335  goto __pyx_L0;
32336 
32337  /* "View.MemoryView":559
32338  *
32339  * @property
32340  * def base(self): # <<<<<<<<<<<<<<
32341  * return self.obj
32342  *
32343  */
32344 
32345  /* function exit code */
32346  __pyx_L0:;
32347  __Pyx_XGIVEREF(__pyx_r);
32348  __Pyx_RefNannyFinishContext();
32349  return __pyx_r;
32350 }
32351 
32352 /* "View.MemoryView":563
32353  *
32354  * @property
32355  * def shape(self): # <<<<<<<<<<<<<<
32356  * return tuple([length for length in self.view.shape[:self.view.ndim]])
32357  *
32358  */
32359 
32360 /* Python wrapper */
32361 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/
32362 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
32363  PyObject *__pyx_r = 0;
32364  __Pyx_RefNannyDeclarations
32365  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
32366  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
32367 
32368  /* function exit code */
32369  __Pyx_RefNannyFinishContext();
32370  return __pyx_r;
32371 }
32372 
32373 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
32374  Py_ssize_t __pyx_v_length;
32375  PyObject *__pyx_r = NULL;
32376  __Pyx_RefNannyDeclarations
32377  PyObject *__pyx_t_1 = NULL;
32378  Py_ssize_t *__pyx_t_2;
32379  Py_ssize_t *__pyx_t_3;
32380  Py_ssize_t *__pyx_t_4;
32381  PyObject *__pyx_t_5 = NULL;
32382  __Pyx_RefNannySetupContext("__get__", 0);
32383 
32384  /* "View.MemoryView":564
32385  * @property
32386  * def shape(self):
32387  * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<<
32388  *
32389  * @property
32390  */
32391  __Pyx_XDECREF(__pyx_r);
32392  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 564, __pyx_L1_error)
32393  __Pyx_GOTREF(__pyx_t_1);
32394  __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
32395  for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
32396  __pyx_t_2 = __pyx_t_4;
32397  __pyx_v_length = (__pyx_t_2[0]);
32398  __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 564, __pyx_L1_error)
32399  __Pyx_GOTREF(__pyx_t_5);
32400  if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(2, 564, __pyx_L1_error)
32401  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
32402  }
32403  __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 564, __pyx_L1_error)
32404  __Pyx_GOTREF(__pyx_t_5);
32405  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32406  __pyx_r = __pyx_t_5;
32407  __pyx_t_5 = 0;
32408  goto __pyx_L0;
32409 
32410  /* "View.MemoryView":563
32411  *
32412  * @property
32413  * def shape(self): # <<<<<<<<<<<<<<
32414  * return tuple([length for length in self.view.shape[:self.view.ndim]])
32415  *
32416  */
32417 
32418  /* function exit code */
32419  __pyx_L1_error:;
32420  __Pyx_XDECREF(__pyx_t_1);
32421  __Pyx_XDECREF(__pyx_t_5);
32422  __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
32423  __pyx_r = NULL;
32424  __pyx_L0:;
32425  __Pyx_XGIVEREF(__pyx_r);
32426  __Pyx_RefNannyFinishContext();
32427  return __pyx_r;
32428 }
32429 
32430 /* "View.MemoryView":567
32431  *
32432  * @property
32433  * def strides(self): # <<<<<<<<<<<<<<
32434  * if self.view.strides == NULL:
32435  *
32436  */
32437 
32438 /* Python wrapper */
32439 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/
32440 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
32441  PyObject *__pyx_r = 0;
32442  __Pyx_RefNannyDeclarations
32443  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
32444  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
32445 
32446  /* function exit code */
32447  __Pyx_RefNannyFinishContext();
32448  return __pyx_r;
32449 }
32450 
32451 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
32452  Py_ssize_t __pyx_v_stride;
32453  PyObject *__pyx_r = NULL;
32454  __Pyx_RefNannyDeclarations
32455  int __pyx_t_1;
32456  PyObject *__pyx_t_2 = NULL;
32457  Py_ssize_t *__pyx_t_3;
32458  Py_ssize_t *__pyx_t_4;
32459  Py_ssize_t *__pyx_t_5;
32460  PyObject *__pyx_t_6 = NULL;
32461  __Pyx_RefNannySetupContext("__get__", 0);
32462 
32463  /* "View.MemoryView":568
32464  * @property
32465  * def strides(self):
32466  * if self.view.strides == NULL: # <<<<<<<<<<<<<<
32467  *
32468  * raise ValueError("Buffer view does not expose strides")
32469  */
32470  __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
32471  if (unlikely(__pyx_t_1)) {
32472 
32473  /* "View.MemoryView":570
32474  * if self.view.strides == NULL:
32475  *
32476  * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<<
32477  *
32478  * return tuple([stride for stride in self.view.strides[:self.view.ndim]])
32479  */
32480  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 570, __pyx_L1_error)
32481  __Pyx_GOTREF(__pyx_t_2);
32482  __Pyx_Raise(__pyx_t_2, 0, 0, 0);
32483  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
32484  __PYX_ERR(2, 570, __pyx_L1_error)
32485 
32486  /* "View.MemoryView":568
32487  * @property
32488  * def strides(self):
32489  * if self.view.strides == NULL: # <<<<<<<<<<<<<<
32490  *
32491  * raise ValueError("Buffer view does not expose strides")
32492  */
32493  }
32494 
32495  /* "View.MemoryView":572
32496  * raise ValueError("Buffer view does not expose strides")
32497  *
32498  * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<<
32499  *
32500  * @property
32501  */
32502  __Pyx_XDECREF(__pyx_r);
32503  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 572, __pyx_L1_error)
32504  __Pyx_GOTREF(__pyx_t_2);
32505  __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
32506  for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
32507  __pyx_t_3 = __pyx_t_5;
32508  __pyx_v_stride = (__pyx_t_3[0]);
32509  __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 572, __pyx_L1_error)
32510  __Pyx_GOTREF(__pyx_t_6);
32511  if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(2, 572, __pyx_L1_error)
32512  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
32513  }
32514  __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 572, __pyx_L1_error)
32515  __Pyx_GOTREF(__pyx_t_6);
32516  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
32517  __pyx_r = __pyx_t_6;
32518  __pyx_t_6 = 0;
32519  goto __pyx_L0;
32520 
32521  /* "View.MemoryView":567
32522  *
32523  * @property
32524  * def strides(self): # <<<<<<<<<<<<<<
32525  * if self.view.strides == NULL:
32526  *
32527  */
32528 
32529  /* function exit code */
32530  __pyx_L1_error:;
32531  __Pyx_XDECREF(__pyx_t_2);
32532  __Pyx_XDECREF(__pyx_t_6);
32533  __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
32534  __pyx_r = NULL;
32535  __pyx_L0:;
32536  __Pyx_XGIVEREF(__pyx_r);
32537  __Pyx_RefNannyFinishContext();
32538  return __pyx_r;
32539 }
32540 
32541 /* "View.MemoryView":575
32542  *
32543  * @property
32544  * def suboffsets(self): # <<<<<<<<<<<<<<
32545  * if self.view.suboffsets == NULL:
32546  * return (-1,) * self.view.ndim
32547  */
32548 
32549 /* Python wrapper */
32550 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/
32551 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
32552  PyObject *__pyx_r = 0;
32553  __Pyx_RefNannyDeclarations
32554  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
32555  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
32556 
32557  /* function exit code */
32558  __Pyx_RefNannyFinishContext();
32559  return __pyx_r;
32560 }
32561 
32562 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
32563  Py_ssize_t __pyx_v_suboffset;
32564  PyObject *__pyx_r = NULL;
32565  __Pyx_RefNannyDeclarations
32566  int __pyx_t_1;
32567  PyObject *__pyx_t_2 = NULL;
32568  PyObject *__pyx_t_3 = NULL;
32569  Py_ssize_t *__pyx_t_4;
32570  Py_ssize_t *__pyx_t_5;
32571  Py_ssize_t *__pyx_t_6;
32572  __Pyx_RefNannySetupContext("__get__", 0);
32573 
32574  /* "View.MemoryView":576
32575  * @property
32576  * def suboffsets(self):
32577  * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<<
32578  * return (-1,) * self.view.ndim
32579  *
32580  */
32581  __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
32582  if (__pyx_t_1) {
32583 
32584  /* "View.MemoryView":577
32585  * def suboffsets(self):
32586  * if self.view.suboffsets == NULL:
32587  * return (-1,) * self.view.ndim # <<<<<<<<<<<<<<
32588  *
32589  * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
32590  */
32591  __Pyx_XDECREF(__pyx_r);
32592  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 577, __pyx_L1_error)
32593  __Pyx_GOTREF(__pyx_t_2);
32594  __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__25, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 577, __pyx_L1_error)
32595  __Pyx_GOTREF(__pyx_t_3);
32596  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
32597  __pyx_r = __pyx_t_3;
32598  __pyx_t_3 = 0;
32599  goto __pyx_L0;
32600 
32601  /* "View.MemoryView":576
32602  * @property
32603  * def suboffsets(self):
32604  * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<<
32605  * return (-1,) * self.view.ndim
32606  *
32607  */
32608  }
32609 
32610  /* "View.MemoryView":579
32611  * return (-1,) * self.view.ndim
32612  *
32613  * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<<
32614  *
32615  * @property
32616  */
32617  __Pyx_XDECREF(__pyx_r);
32618  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 579, __pyx_L1_error)
32619  __Pyx_GOTREF(__pyx_t_3);
32620  __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
32621  for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
32622  __pyx_t_4 = __pyx_t_6;
32623  __pyx_v_suboffset = (__pyx_t_4[0]);
32624  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error)
32625  __Pyx_GOTREF(__pyx_t_2);
32626  if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(2, 579, __pyx_L1_error)
32627  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
32628  }
32629  __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error)
32630  __Pyx_GOTREF(__pyx_t_2);
32631  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
32632  __pyx_r = __pyx_t_2;
32633  __pyx_t_2 = 0;
32634  goto __pyx_L0;
32635 
32636  /* "View.MemoryView":575
32637  *
32638  * @property
32639  * def suboffsets(self): # <<<<<<<<<<<<<<
32640  * if self.view.suboffsets == NULL:
32641  * return (-1,) * self.view.ndim
32642  */
32643 
32644  /* function exit code */
32645  __pyx_L1_error:;
32646  __Pyx_XDECREF(__pyx_t_2);
32647  __Pyx_XDECREF(__pyx_t_3);
32648  __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
32649  __pyx_r = NULL;
32650  __pyx_L0:;
32651  __Pyx_XGIVEREF(__pyx_r);
32652  __Pyx_RefNannyFinishContext();
32653  return __pyx_r;
32654 }
32655 
32656 /* "View.MemoryView":582
32657  *
32658  * @property
32659  * def ndim(self): # <<<<<<<<<<<<<<
32660  * return self.view.ndim
32661  *
32662  */
32663 
32664 /* Python wrapper */
32665 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/
32666 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
32667  PyObject *__pyx_r = 0;
32668  __Pyx_RefNannyDeclarations
32669  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
32670  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
32671 
32672  /* function exit code */
32673  __Pyx_RefNannyFinishContext();
32674  return __pyx_r;
32675 }
32676 
32677 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
32678  PyObject *__pyx_r = NULL;
32679  __Pyx_RefNannyDeclarations
32680  PyObject *__pyx_t_1 = NULL;
32681  __Pyx_RefNannySetupContext("__get__", 0);
32682 
32683  /* "View.MemoryView":583
32684  * @property
32685  * def ndim(self):
32686  * return self.view.ndim # <<<<<<<<<<<<<<
32687  *
32688  * @property
32689  */
32690  __Pyx_XDECREF(__pyx_r);
32691  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 583, __pyx_L1_error)
32692  __Pyx_GOTREF(__pyx_t_1);
32693  __pyx_r = __pyx_t_1;
32694  __pyx_t_1 = 0;
32695  goto __pyx_L0;
32696 
32697  /* "View.MemoryView":582
32698  *
32699  * @property
32700  * def ndim(self): # <<<<<<<<<<<<<<
32701  * return self.view.ndim
32702  *
32703  */
32704 
32705  /* function exit code */
32706  __pyx_L1_error:;
32707  __Pyx_XDECREF(__pyx_t_1);
32708  __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
32709  __pyx_r = NULL;
32710  __pyx_L0:;
32711  __Pyx_XGIVEREF(__pyx_r);
32712  __Pyx_RefNannyFinishContext();
32713  return __pyx_r;
32714 }
32715 
32716 /* "View.MemoryView":586
32717  *
32718  * @property
32719  * def itemsize(self): # <<<<<<<<<<<<<<
32720  * return self.view.itemsize
32721  *
32722  */
32723 
32724 /* Python wrapper */
32725 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/
32726 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
32727  PyObject *__pyx_r = 0;
32728  __Pyx_RefNannyDeclarations
32729  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
32730  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
32731 
32732  /* function exit code */
32733  __Pyx_RefNannyFinishContext();
32734  return __pyx_r;
32735 }
32736 
32737 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
32738  PyObject *__pyx_r = NULL;
32739  __Pyx_RefNannyDeclarations
32740  PyObject *__pyx_t_1 = NULL;
32741  __Pyx_RefNannySetupContext("__get__", 0);
32742 
32743  /* "View.MemoryView":587
32744  * @property
32745  * def itemsize(self):
32746  * return self.view.itemsize # <<<<<<<<<<<<<<
32747  *
32748  * @property
32749  */
32750  __Pyx_XDECREF(__pyx_r);
32751  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 587, __pyx_L1_error)
32752  __Pyx_GOTREF(__pyx_t_1);
32753  __pyx_r = __pyx_t_1;
32754  __pyx_t_1 = 0;
32755  goto __pyx_L0;
32756 
32757  /* "View.MemoryView":586
32758  *
32759  * @property
32760  * def itemsize(self): # <<<<<<<<<<<<<<
32761  * return self.view.itemsize
32762  *
32763  */
32764 
32765  /* function exit code */
32766  __pyx_L1_error:;
32767  __Pyx_XDECREF(__pyx_t_1);
32768  __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
32769  __pyx_r = NULL;
32770  __pyx_L0:;
32771  __Pyx_XGIVEREF(__pyx_r);
32772  __Pyx_RefNannyFinishContext();
32773  return __pyx_r;
32774 }
32775 
32776 /* "View.MemoryView":590
32777  *
32778  * @property
32779  * def nbytes(self): # <<<<<<<<<<<<<<
32780  * return self.size * self.view.itemsize
32781  *
32782  */
32783 
32784 /* Python wrapper */
32785 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/
32786 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
32787  PyObject *__pyx_r = 0;
32788  __Pyx_RefNannyDeclarations
32789  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
32790  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
32791 
32792  /* function exit code */
32793  __Pyx_RefNannyFinishContext();
32794  return __pyx_r;
32795 }
32796 
32797 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
32798  PyObject *__pyx_r = NULL;
32799  __Pyx_RefNannyDeclarations
32800  PyObject *__pyx_t_1 = NULL;
32801  PyObject *__pyx_t_2 = NULL;
32802  PyObject *__pyx_t_3 = NULL;
32803  __Pyx_RefNannySetupContext("__get__", 0);
32804 
32805  /* "View.MemoryView":591
32806  * @property
32807  * def nbytes(self):
32808  * return self.size * self.view.itemsize # <<<<<<<<<<<<<<
32809  *
32810  * @property
32811  */
32812  __Pyx_XDECREF(__pyx_r);
32813  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 591, __pyx_L1_error)
32814  __Pyx_GOTREF(__pyx_t_1);
32815  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 591, __pyx_L1_error)
32816  __Pyx_GOTREF(__pyx_t_2);
32817  __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 591, __pyx_L1_error)
32818  __Pyx_GOTREF(__pyx_t_3);
32819  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32820  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
32821  __pyx_r = __pyx_t_3;
32822  __pyx_t_3 = 0;
32823  goto __pyx_L0;
32824 
32825  /* "View.MemoryView":590
32826  *
32827  * @property
32828  * def nbytes(self): # <<<<<<<<<<<<<<
32829  * return self.size * self.view.itemsize
32830  *
32831  */
32832 
32833  /* function exit code */
32834  __pyx_L1_error:;
32835  __Pyx_XDECREF(__pyx_t_1);
32836  __Pyx_XDECREF(__pyx_t_2);
32837  __Pyx_XDECREF(__pyx_t_3);
32838  __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
32839  __pyx_r = NULL;
32840  __pyx_L0:;
32841  __Pyx_XGIVEREF(__pyx_r);
32842  __Pyx_RefNannyFinishContext();
32843  return __pyx_r;
32844 }
32845 
32846 /* "View.MemoryView":594
32847  *
32848  * @property
32849  * def size(self): # <<<<<<<<<<<<<<
32850  * if self._size is None:
32851  * result = 1
32852  */
32853 
32854 /* Python wrapper */
32855 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
32856 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
32857  PyObject *__pyx_r = 0;
32858  __Pyx_RefNannyDeclarations
32859  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
32860  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
32861 
32862  /* function exit code */
32863  __Pyx_RefNannyFinishContext();
32864  return __pyx_r;
32865 }
32866 
32867 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
32868  PyObject *__pyx_v_result = NULL;
32869  PyObject *__pyx_v_length = NULL;
32870  PyObject *__pyx_r = NULL;
32871  __Pyx_RefNannyDeclarations
32872  int __pyx_t_1;
32873  int __pyx_t_2;
32874  Py_ssize_t *__pyx_t_3;
32875  Py_ssize_t *__pyx_t_4;
32876  Py_ssize_t *__pyx_t_5;
32877  PyObject *__pyx_t_6 = NULL;
32878  __Pyx_RefNannySetupContext("__get__", 0);
32879 
32880  /* "View.MemoryView":595
32881  * @property
32882  * def size(self):
32883  * if self._size is None: # <<<<<<<<<<<<<<
32884  * result = 1
32885  *
32886  */
32887  __pyx_t_1 = (__pyx_v_self->_size == Py_None);
32888  __pyx_t_2 = (__pyx_t_1 != 0);
32889  if (__pyx_t_2) {
32890 
32891  /* "View.MemoryView":596
32892  * def size(self):
32893  * if self._size is None:
32894  * result = 1 # <<<<<<<<<<<<<<
32895  *
32896  * for length in self.view.shape[:self.view.ndim]:
32897  */
32898  __Pyx_INCREF(__pyx_int_1);
32899  __pyx_v_result = __pyx_int_1;
32900 
32901  /* "View.MemoryView":598
32902  * result = 1
32903  *
32904  * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<<
32905  * result *= length
32906  *
32907  */
32908  __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
32909  for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
32910  __pyx_t_3 = __pyx_t_5;
32911  __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 598, __pyx_L1_error)
32912  __Pyx_GOTREF(__pyx_t_6);
32913  __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6);
32914  __pyx_t_6 = 0;
32915 
32916  /* "View.MemoryView":599
32917  *
32918  * for length in self.view.shape[:self.view.ndim]:
32919  * result *= length # <<<<<<<<<<<<<<
32920  *
32921  * self._size = result
32922  */
32923  __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 599, __pyx_L1_error)
32924  __Pyx_GOTREF(__pyx_t_6);
32925  __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6);
32926  __pyx_t_6 = 0;
32927  }
32928 
32929  /* "View.MemoryView":601
32930  * result *= length
32931  *
32932  * self._size = result # <<<<<<<<<<<<<<
32933  *
32934  * return self._size
32935  */
32936  __Pyx_INCREF(__pyx_v_result);
32937  __Pyx_GIVEREF(__pyx_v_result);
32938  __Pyx_GOTREF(__pyx_v_self->_size);
32939  __Pyx_DECREF(__pyx_v_self->_size);
32940  __pyx_v_self->_size = __pyx_v_result;
32941 
32942  /* "View.MemoryView":595
32943  * @property
32944  * def size(self):
32945  * if self._size is None: # <<<<<<<<<<<<<<
32946  * result = 1
32947  *
32948  */
32949  }
32950 
32951  /* "View.MemoryView":603
32952  * self._size = result
32953  *
32954  * return self._size # <<<<<<<<<<<<<<
32955  *
32956  * def __len__(self):
32957  */
32958  __Pyx_XDECREF(__pyx_r);
32959  __Pyx_INCREF(__pyx_v_self->_size);
32960  __pyx_r = __pyx_v_self->_size;
32961  goto __pyx_L0;
32962 
32963  /* "View.MemoryView":594
32964  *
32965  * @property
32966  * def size(self): # <<<<<<<<<<<<<<
32967  * if self._size is None:
32968  * result = 1
32969  */
32970 
32971  /* function exit code */
32972  __pyx_L1_error:;
32973  __Pyx_XDECREF(__pyx_t_6);
32974  __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
32975  __pyx_r = NULL;
32976  __pyx_L0:;
32977  __Pyx_XDECREF(__pyx_v_result);
32978  __Pyx_XDECREF(__pyx_v_length);
32979  __Pyx_XGIVEREF(__pyx_r);
32980  __Pyx_RefNannyFinishContext();
32981  return __pyx_r;
32982 }
32983 
32984 /* "View.MemoryView":605
32985  * return self._size
32986  *
32987  * def __len__(self): # <<<<<<<<<<<<<<
32988  * if self.view.ndim >= 1:
32989  * return self.view.shape[0]
32990  */
32991 
32992 /* Python wrapper */
32993 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/
32994 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
32995  Py_ssize_t __pyx_r;
32996  __Pyx_RefNannyDeclarations
32997  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
32998  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self));
32999 
33000  /* function exit code */
33001  __Pyx_RefNannyFinishContext();
33002  return __pyx_r;
33003 }
33004 
33005 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) {
33006  Py_ssize_t __pyx_r;
33007  __Pyx_RefNannyDeclarations
33008  int __pyx_t_1;
33009  __Pyx_RefNannySetupContext("__len__", 0);
33010 
33011  /* "View.MemoryView":606
33012  *
33013  * def __len__(self):
33014  * if self.view.ndim >= 1: # <<<<<<<<<<<<<<
33015  * return self.view.shape[0]
33016  *
33017  */
33018  __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
33019  if (__pyx_t_1) {
33020 
33021  /* "View.MemoryView":607
33022  * def __len__(self):
33023  * if self.view.ndim >= 1:
33024  * return self.view.shape[0] # <<<<<<<<<<<<<<
33025  *
33026  * return 0
33027  */
33028  __pyx_r = (__pyx_v_self->view.shape[0]);
33029  goto __pyx_L0;
33030 
33031  /* "View.MemoryView":606
33032  *
33033  * def __len__(self):
33034  * if self.view.ndim >= 1: # <<<<<<<<<<<<<<
33035  * return self.view.shape[0]
33036  *
33037  */
33038  }
33039 
33040  /* "View.MemoryView":609
33041  * return self.view.shape[0]
33042  *
33043  * return 0 # <<<<<<<<<<<<<<
33044  *
33045  * def __repr__(self):
33046  */
33047  __pyx_r = 0;
33048  goto __pyx_L0;
33049 
33050  /* "View.MemoryView":605
33051  * return self._size
33052  *
33053  * def __len__(self): # <<<<<<<<<<<<<<
33054  * if self.view.ndim >= 1:
33055  * return self.view.shape[0]
33056  */
33057 
33058  /* function exit code */
33059  __pyx_L0:;
33060  __Pyx_RefNannyFinishContext();
33061  return __pyx_r;
33062 }
33063 
33064 /* "View.MemoryView":611
33065  * return 0
33066  *
33067  * def __repr__(self): # <<<<<<<<<<<<<<
33068  * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
33069  * id(self))
33070  */
33071 
33072 /* Python wrapper */
33073 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/
33074 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
33075  PyObject *__pyx_r = 0;
33076  __Pyx_RefNannyDeclarations
33077  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
33078  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self));
33079 
33080  /* function exit code */
33081  __Pyx_RefNannyFinishContext();
33082  return __pyx_r;
33083 }
33084 
33085 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) {
33086  PyObject *__pyx_r = NULL;
33087  __Pyx_RefNannyDeclarations
33088  PyObject *__pyx_t_1 = NULL;
33089  PyObject *__pyx_t_2 = NULL;
33090  PyObject *__pyx_t_3 = NULL;
33091  __Pyx_RefNannySetupContext("__repr__", 0);
33092 
33093  /* "View.MemoryView":612
33094  *
33095  * def __repr__(self):
33096  * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__, # <<<<<<<<<<<<<<
33097  * id(self))
33098  *
33099  */
33100  __Pyx_XDECREF(__pyx_r);
33101  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 612, __pyx_L1_error)
33102  __Pyx_GOTREF(__pyx_t_1);
33103  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 612, __pyx_L1_error)
33104  __Pyx_GOTREF(__pyx_t_2);
33105  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
33106  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 612, __pyx_L1_error)
33107  __Pyx_GOTREF(__pyx_t_1);
33108  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
33109 
33110  /* "View.MemoryView":613
33111  * def __repr__(self):
33112  * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
33113  * id(self)) # <<<<<<<<<<<<<<
33114  *
33115  * def __str__(self):
33116  */
33117  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 613, __pyx_L1_error)
33118  __Pyx_GOTREF(__pyx_t_2);
33119 
33120  /* "View.MemoryView":612
33121  *
33122  * def __repr__(self):
33123  * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__, # <<<<<<<<<<<<<<
33124  * id(self))
33125  *
33126  */
33127  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 612, __pyx_L1_error)
33128  __Pyx_GOTREF(__pyx_t_3);
33129  __Pyx_GIVEREF(__pyx_t_1);
33130  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
33131  __Pyx_GIVEREF(__pyx_t_2);
33132  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
33133  __pyx_t_1 = 0;
33134  __pyx_t_2 = 0;
33135  __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 612, __pyx_L1_error)
33136  __Pyx_GOTREF(__pyx_t_2);
33137  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
33138  __pyx_r = __pyx_t_2;
33139  __pyx_t_2 = 0;
33140  goto __pyx_L0;
33141 
33142  /* "View.MemoryView":611
33143  * return 0
33144  *
33145  * def __repr__(self): # <<<<<<<<<<<<<<
33146  * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
33147  * id(self))
33148  */
33149 
33150  /* function exit code */
33151  __pyx_L1_error:;
33152  __Pyx_XDECREF(__pyx_t_1);
33153  __Pyx_XDECREF(__pyx_t_2);
33154  __Pyx_XDECREF(__pyx_t_3);
33155  __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
33156  __pyx_r = NULL;
33157  __pyx_L0:;
33158  __Pyx_XGIVEREF(__pyx_r);
33159  __Pyx_RefNannyFinishContext();
33160  return __pyx_r;
33161 }
33162 
33163 /* "View.MemoryView":615
33164  * id(self))
33165  *
33166  * def __str__(self): # <<<<<<<<<<<<<<
33167  * return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
33168  *
33169  */
33170 
33171 /* Python wrapper */
33172 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/
33173 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
33174  PyObject *__pyx_r = 0;
33175  __Pyx_RefNannyDeclarations
33176  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
33177  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self));
33178 
33179  /* function exit code */
33180  __Pyx_RefNannyFinishContext();
33181  return __pyx_r;
33182 }
33183 
33184 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) {
33185  PyObject *__pyx_r = NULL;
33186  __Pyx_RefNannyDeclarations
33187  PyObject *__pyx_t_1 = NULL;
33188  PyObject *__pyx_t_2 = NULL;
33189  __Pyx_RefNannySetupContext("__str__", 0);
33190 
33191  /* "View.MemoryView":616
33192  *
33193  * def __str__(self):
33194  * return "<MemoryView of %r object>" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<<
33195  *
33196  *
33197  */
33198  __Pyx_XDECREF(__pyx_r);
33199  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 616, __pyx_L1_error)
33200  __Pyx_GOTREF(__pyx_t_1);
33201  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 616, __pyx_L1_error)
33202  __Pyx_GOTREF(__pyx_t_2);
33203  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
33204  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 616, __pyx_L1_error)
33205  __Pyx_GOTREF(__pyx_t_1);
33206  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
33207  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 616, __pyx_L1_error)
33208  __Pyx_GOTREF(__pyx_t_2);
33209  __Pyx_GIVEREF(__pyx_t_1);
33210  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
33211  __pyx_t_1 = 0;
33212  __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 616, __pyx_L1_error)
33213  __Pyx_GOTREF(__pyx_t_1);
33214  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
33215  __pyx_r = __pyx_t_1;
33216  __pyx_t_1 = 0;
33217  goto __pyx_L0;
33218 
33219  /* "View.MemoryView":615
33220  * id(self))
33221  *
33222  * def __str__(self): # <<<<<<<<<<<<<<
33223  * return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
33224  *
33225  */
33226 
33227  /* function exit code */
33228  __pyx_L1_error:;
33229  __Pyx_XDECREF(__pyx_t_1);
33230  __Pyx_XDECREF(__pyx_t_2);
33231  __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
33232  __pyx_r = NULL;
33233  __pyx_L0:;
33234  __Pyx_XGIVEREF(__pyx_r);
33235  __Pyx_RefNannyFinishContext();
33236  return __pyx_r;
33237 }
33238 
33239 /* "View.MemoryView":619
33240  *
33241  *
33242  * def is_c_contig(self): # <<<<<<<<<<<<<<
33243  * cdef __Pyx_memviewslice *mslice
33244  * cdef __Pyx_memviewslice tmp
33245  */
33246 
33247 /* Python wrapper */
33248 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
33249 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
33250  PyObject *__pyx_r = 0;
33251  __Pyx_RefNannyDeclarations
33252  __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0);
33253  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
33254 
33255  /* function exit code */
33256  __Pyx_RefNannyFinishContext();
33257  return __pyx_r;
33258 }
33259 
33260 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
33261  __Pyx_memviewslice *__pyx_v_mslice;
33262  __Pyx_memviewslice __pyx_v_tmp;
33263  PyObject *__pyx_r = NULL;
33264  __Pyx_RefNannyDeclarations
33265  __Pyx_memviewslice *__pyx_t_1;
33266  PyObject *__pyx_t_2 = NULL;
33267  __Pyx_RefNannySetupContext("is_c_contig", 0);
33268 
33269  /* "View.MemoryView":622
33270  * cdef __Pyx_memviewslice *mslice
33271  * cdef __Pyx_memviewslice tmp
33272  * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<<
33273  * return slice_is_contig(mslice[0], 'C', self.view.ndim)
33274  *
33275  */
33276  __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 622, __pyx_L1_error)
33277  __pyx_v_mslice = __pyx_t_1;
33278 
33279  /* "View.MemoryView":623
33280  * cdef __Pyx_memviewslice tmp
33281  * mslice = get_slice_from_memview(self, &tmp)
33282  * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<<
33283  *
33284  * def is_f_contig(self):
33285  */
33286  __Pyx_XDECREF(__pyx_r);
33287  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 623, __pyx_L1_error)
33288  __Pyx_GOTREF(__pyx_t_2);
33289  __pyx_r = __pyx_t_2;
33290  __pyx_t_2 = 0;
33291  goto __pyx_L0;
33292 
33293  /* "View.MemoryView":619
33294  *
33295  *
33296  * def is_c_contig(self): # <<<<<<<<<<<<<<
33297  * cdef __Pyx_memviewslice *mslice
33298  * cdef __Pyx_memviewslice tmp
33299  */
33300 
33301  /* function exit code */
33302  __pyx_L1_error:;
33303  __Pyx_XDECREF(__pyx_t_2);
33304  __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
33305  __pyx_r = NULL;
33306  __pyx_L0:;
33307  __Pyx_XGIVEREF(__pyx_r);
33308  __Pyx_RefNannyFinishContext();
33309  return __pyx_r;
33310 }
33311 
33312 /* "View.MemoryView":625
33313  * return slice_is_contig(mslice[0], 'C', self.view.ndim)
33314  *
33315  * def is_f_contig(self): # <<<<<<<<<<<<<<
33316  * cdef __Pyx_memviewslice *mslice
33317  * cdef __Pyx_memviewslice tmp
33318  */
33319 
33320 /* Python wrapper */
33321 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
33322 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
33323  PyObject *__pyx_r = 0;
33324  __Pyx_RefNannyDeclarations
33325  __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0);
33326  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
33327 
33328  /* function exit code */
33329  __Pyx_RefNannyFinishContext();
33330  return __pyx_r;
33331 }
33332 
33333 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
33334  __Pyx_memviewslice *__pyx_v_mslice;
33335  __Pyx_memviewslice __pyx_v_tmp;
33336  PyObject *__pyx_r = NULL;
33337  __Pyx_RefNannyDeclarations
33338  __Pyx_memviewslice *__pyx_t_1;
33339  PyObject *__pyx_t_2 = NULL;
33340  __Pyx_RefNannySetupContext("is_f_contig", 0);
33341 
33342  /* "View.MemoryView":628
33343  * cdef __Pyx_memviewslice *mslice
33344  * cdef __Pyx_memviewslice tmp
33345  * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<<
33346  * return slice_is_contig(mslice[0], 'F', self.view.ndim)
33347  *
33348  */
33349  __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 628, __pyx_L1_error)
33350  __pyx_v_mslice = __pyx_t_1;
33351 
33352  /* "View.MemoryView":629
33353  * cdef __Pyx_memviewslice tmp
33354  * mslice = get_slice_from_memview(self, &tmp)
33355  * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<<
33356  *
33357  * def copy(self):
33358  */
33359  __Pyx_XDECREF(__pyx_r);
33360  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 629, __pyx_L1_error)
33361  __Pyx_GOTREF(__pyx_t_2);
33362  __pyx_r = __pyx_t_2;
33363  __pyx_t_2 = 0;
33364  goto __pyx_L0;
33365 
33366  /* "View.MemoryView":625
33367  * return slice_is_contig(mslice[0], 'C', self.view.ndim)
33368  *
33369  * def is_f_contig(self): # <<<<<<<<<<<<<<
33370  * cdef __Pyx_memviewslice *mslice
33371  * cdef __Pyx_memviewslice tmp
33372  */
33373 
33374  /* function exit code */
33375  __pyx_L1_error:;
33376  __Pyx_XDECREF(__pyx_t_2);
33377  __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
33378  __pyx_r = NULL;
33379  __pyx_L0:;
33380  __Pyx_XGIVEREF(__pyx_r);
33381  __Pyx_RefNannyFinishContext();
33382  return __pyx_r;
33383 }
33384 
33385 /* "View.MemoryView":631
33386  * return slice_is_contig(mslice[0], 'F', self.view.ndim)
33387  *
33388  * def copy(self): # <<<<<<<<<<<<<<
33389  * cdef __Pyx_memviewslice mslice
33390  * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
33391  */
33392 
33393 /* Python wrapper */
33394 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
33395 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
33396  PyObject *__pyx_r = 0;
33397  __Pyx_RefNannyDeclarations
33398  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
33399  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self));
33400 
33401  /* function exit code */
33402  __Pyx_RefNannyFinishContext();
33403  return __pyx_r;
33404 }
33405 
33406 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) {
33407  __Pyx_memviewslice __pyx_v_mslice;
33408  int __pyx_v_flags;
33409  PyObject *__pyx_r = NULL;
33410  __Pyx_RefNannyDeclarations
33411  __Pyx_memviewslice __pyx_t_1;
33412  PyObject *__pyx_t_2 = NULL;
33413  __Pyx_RefNannySetupContext("copy", 0);
33414 
33415  /* "View.MemoryView":633
33416  * def copy(self):
33417  * cdef __Pyx_memviewslice mslice
33418  * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<<
33419  *
33420  * slice_copy(self, &mslice)
33421  */
33422  __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));
33423 
33424  /* "View.MemoryView":635
33425  * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
33426  *
33427  * slice_copy(self, &mslice) # <<<<<<<<<<<<<<
33428  * mslice = slice_copy_contig(&mslice, "c", self.view.ndim,
33429  * self.view.itemsize,
33430  */
33431  __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));
33432 
33433  /* "View.MemoryView":636
33434  *
33435  * slice_copy(self, &mslice)
33436  * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<<
33437  * self.view.itemsize,
33438  * flags|PyBUF_C_CONTIGUOUS,
33439  */
33440  __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 636, __pyx_L1_error)
33441  __pyx_v_mslice = __pyx_t_1;
33442 
33443  /* "View.MemoryView":641
33444  * self.dtype_is_object)
33445  *
33446  * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<<
33447  *
33448  * def copy_fortran(self):
33449  */
33450  __Pyx_XDECREF(__pyx_r);
33451  __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 641, __pyx_L1_error)
33452  __Pyx_GOTREF(__pyx_t_2);
33453  __pyx_r = __pyx_t_2;
33454  __pyx_t_2 = 0;
33455  goto __pyx_L0;
33456 
33457  /* "View.MemoryView":631
33458  * return slice_is_contig(mslice[0], 'F', self.view.ndim)
33459  *
33460  * def copy(self): # <<<<<<<<<<<<<<
33461  * cdef __Pyx_memviewslice mslice
33462  * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
33463  */
33464 
33465  /* function exit code */
33466  __pyx_L1_error:;
33467  __Pyx_XDECREF(__pyx_t_2);
33468  __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
33469  __pyx_r = NULL;
33470  __pyx_L0:;
33471  __Pyx_XGIVEREF(__pyx_r);
33472  __Pyx_RefNannyFinishContext();
33473  return __pyx_r;
33474 }
33475 
33476 /* "View.MemoryView":643
33477  * return memoryview_copy_from_slice(self, &mslice)
33478  *
33479  * def copy_fortran(self): # <<<<<<<<<<<<<<
33480  * cdef __Pyx_memviewslice src, dst
33481  * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
33482  */
33483 
33484 /* Python wrapper */
33485 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
33486 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
33487  PyObject *__pyx_r = 0;
33488  __Pyx_RefNannyDeclarations
33489  __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0);
33490  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self));
33491 
33492  /* function exit code */
33493  __Pyx_RefNannyFinishContext();
33494  return __pyx_r;
33495 }
33496 
33497 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) {
33498  __Pyx_memviewslice __pyx_v_src;
33499  __Pyx_memviewslice __pyx_v_dst;
33500  int __pyx_v_flags;
33501  PyObject *__pyx_r = NULL;
33502  __Pyx_RefNannyDeclarations
33503  __Pyx_memviewslice __pyx_t_1;
33504  PyObject *__pyx_t_2 = NULL;
33505  __Pyx_RefNannySetupContext("copy_fortran", 0);
33506 
33507  /* "View.MemoryView":645
33508  * def copy_fortran(self):
33509  * cdef __Pyx_memviewslice src, dst
33510  * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<<
33511  *
33512  * slice_copy(self, &src)
33513  */
33514  __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));
33515 
33516  /* "View.MemoryView":647
33517  * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
33518  *
33519  * slice_copy(self, &src) # <<<<<<<<<<<<<<
33520  * dst = slice_copy_contig(&src, "fortran", self.view.ndim,
33521  * self.view.itemsize,
33522  */
33523  __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));
33524 
33525  /* "View.MemoryView":648
33526  *
33527  * slice_copy(self, &src)
33528  * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<<
33529  * self.view.itemsize,
33530  * flags|PyBUF_F_CONTIGUOUS,
33531  */
33532  __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 648, __pyx_L1_error)
33533  __pyx_v_dst = __pyx_t_1;
33534 
33535  /* "View.MemoryView":653
33536  * self.dtype_is_object)
33537  *
33538  * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<<
33539  *
33540  *
33541  */
33542  __Pyx_XDECREF(__pyx_r);
33543  __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 653, __pyx_L1_error)
33544  __Pyx_GOTREF(__pyx_t_2);
33545  __pyx_r = __pyx_t_2;
33546  __pyx_t_2 = 0;
33547  goto __pyx_L0;
33548 
33549  /* "View.MemoryView":643
33550  * return memoryview_copy_from_slice(self, &mslice)
33551  *
33552  * def copy_fortran(self): # <<<<<<<<<<<<<<
33553  * cdef __Pyx_memviewslice src, dst
33554  * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
33555  */
33556 
33557  /* function exit code */
33558  __pyx_L1_error:;
33559  __Pyx_XDECREF(__pyx_t_2);
33560  __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
33561  __pyx_r = NULL;
33562  __pyx_L0:;
33563  __Pyx_XGIVEREF(__pyx_r);
33564  __Pyx_RefNannyFinishContext();
33565  return __pyx_r;
33566 }
33567 
33568 /* "(tree fragment)":1
33569  * def __reduce_cython__(self): # <<<<<<<<<<<<<<
33570  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
33571  * def __setstate_cython__(self, __pyx_state):
33572  */
33573 
33574 /* Python wrapper */
33575 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
33576 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
33577  PyObject *__pyx_r = 0;
33578  __Pyx_RefNannyDeclarations
33579  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
33580  __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self));
33581 
33582  /* function exit code */
33583  __Pyx_RefNannyFinishContext();
33584  return __pyx_r;
33585 }
33586 
33587 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) {
33588  PyObject *__pyx_r = NULL;
33589  __Pyx_RefNannyDeclarations
33590  PyObject *__pyx_t_1 = NULL;
33591  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
33592 
33593  /* "(tree fragment)":2
33594  * def __reduce_cython__(self):
33595  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
33596  * def __setstate_cython__(self, __pyx_state):
33597  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
33598  */
33599  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
33600  __Pyx_GOTREF(__pyx_t_1);
33601  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
33602  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
33603  __PYX_ERR(2, 2, __pyx_L1_error)
33604 
33605  /* "(tree fragment)":1
33606  * def __reduce_cython__(self): # <<<<<<<<<<<<<<
33607  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
33608  * def __setstate_cython__(self, __pyx_state):
33609  */
33610 
33611  /* function exit code */
33612  __pyx_L1_error:;
33613  __Pyx_XDECREF(__pyx_t_1);
33614  __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
33615  __pyx_r = NULL;
33616  __Pyx_XGIVEREF(__pyx_r);
33617  __Pyx_RefNannyFinishContext();
33618  return __pyx_r;
33619 }
33620 
33621 /* "(tree fragment)":3
33622  * def __reduce_cython__(self):
33623  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
33624  * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
33625  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
33626  */
33627 
33628 /* Python wrapper */
33629 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
33630 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
33631  PyObject *__pyx_r = 0;
33632  __Pyx_RefNannyDeclarations
33633  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
33634  __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
33635 
33636  /* function exit code */
33637  __Pyx_RefNannyFinishContext();
33638  return __pyx_r;
33639 }
33640 
33641 static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
33642  PyObject *__pyx_r = NULL;
33643  __Pyx_RefNannyDeclarations
33644  PyObject *__pyx_t_1 = NULL;
33645  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
33646 
33647  /* "(tree fragment)":4
33648  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
33649  * def __setstate_cython__(self, __pyx_state):
33650  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
33651  */
33652  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
33653  __Pyx_GOTREF(__pyx_t_1);
33654  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
33655  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
33656  __PYX_ERR(2, 4, __pyx_L1_error)
33657 
33658  /* "(tree fragment)":3
33659  * def __reduce_cython__(self):
33660  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
33661  * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
33662  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
33663  */
33664 
33665  /* function exit code */
33666  __pyx_L1_error:;
33667  __Pyx_XDECREF(__pyx_t_1);
33668  __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
33669  __pyx_r = NULL;
33670  __Pyx_XGIVEREF(__pyx_r);
33671  __Pyx_RefNannyFinishContext();
33672  return __pyx_r;
33673 }
33674 
33675 /* "View.MemoryView":657
33676  *
33677  * @cname('__pyx_memoryview_new')
33678  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<<
33679  * cdef memoryview result = memoryview(o, flags, dtype_is_object)
33680  * result.typeinfo = typeinfo
33681  */
33682 
33683 static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
33684  struct __pyx_memoryview_obj *__pyx_v_result = 0;
33685  PyObject *__pyx_r = NULL;
33686  __Pyx_RefNannyDeclarations
33687  PyObject *__pyx_t_1 = NULL;
33688  PyObject *__pyx_t_2 = NULL;
33689  PyObject *__pyx_t_3 = NULL;
33690  __Pyx_RefNannySetupContext("memoryview_cwrapper", 0);
33691 
33692  /* "View.MemoryView":658
33693  * @cname('__pyx_memoryview_new')
33694  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
33695  * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<<
33696  * result.typeinfo = typeinfo
33697  * return result
33698  */
33699  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 658, __pyx_L1_error)
33700  __Pyx_GOTREF(__pyx_t_1);
33701  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 658, __pyx_L1_error)
33702  __Pyx_GOTREF(__pyx_t_2);
33703  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 658, __pyx_L1_error)
33704  __Pyx_GOTREF(__pyx_t_3);
33705  __Pyx_INCREF(__pyx_v_o);
33706  __Pyx_GIVEREF(__pyx_v_o);
33707  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
33708  __Pyx_GIVEREF(__pyx_t_1);
33709  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
33710  __Pyx_GIVEREF(__pyx_t_2);
33711  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
33712  __pyx_t_1 = 0;
33713  __pyx_t_2 = 0;
33714  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 658, __pyx_L1_error)
33715  __Pyx_GOTREF(__pyx_t_2);
33716  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
33717  __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2);
33718  __pyx_t_2 = 0;
33719 
33720  /* "View.MemoryView":659
33721  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
33722  * cdef memoryview result = memoryview(o, flags, dtype_is_object)
33723  * result.typeinfo = typeinfo # <<<<<<<<<<<<<<
33724  * return result
33725  *
33726  */
33727  __pyx_v_result->typeinfo = __pyx_v_typeinfo;
33728 
33729  /* "View.MemoryView":660
33730  * cdef memoryview result = memoryview(o, flags, dtype_is_object)
33731  * result.typeinfo = typeinfo
33732  * return result # <<<<<<<<<<<<<<
33733  *
33734  * @cname('__pyx_memoryview_check')
33735  */
33736  __Pyx_XDECREF(__pyx_r);
33737  __Pyx_INCREF(((PyObject *)__pyx_v_result));
33738  __pyx_r = ((PyObject *)__pyx_v_result);
33739  goto __pyx_L0;
33740 
33741  /* "View.MemoryView":657
33742  *
33743  * @cname('__pyx_memoryview_new')
33744  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<<
33745  * cdef memoryview result = memoryview(o, flags, dtype_is_object)
33746  * result.typeinfo = typeinfo
33747  */
33748 
33749  /* function exit code */
33750  __pyx_L1_error:;
33751  __Pyx_XDECREF(__pyx_t_1);
33752  __Pyx_XDECREF(__pyx_t_2);
33753  __Pyx_XDECREF(__pyx_t_3);
33754  __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
33755  __pyx_r = 0;
33756  __pyx_L0:;
33757  __Pyx_XDECREF((PyObject *)__pyx_v_result);
33758  __Pyx_XGIVEREF(__pyx_r);
33759  __Pyx_RefNannyFinishContext();
33760  return __pyx_r;
33761 }
33762 
33763 /* "View.MemoryView":663
33764  *
33765  * @cname('__pyx_memoryview_check')
33766  * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<<
33767  * return isinstance(o, memoryview)
33768  *
33769  */
33770 
33771 static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
33772  int __pyx_r;
33773  __Pyx_RefNannyDeclarations
33774  int __pyx_t_1;
33775  __Pyx_RefNannySetupContext("memoryview_check", 0);
33776 
33777  /* "View.MemoryView":664
33778  * @cname('__pyx_memoryview_check')
33779  * cdef inline bint memoryview_check(object o):
33780  * return isinstance(o, memoryview) # <<<<<<<<<<<<<<
33781  *
33782  * cdef tuple _unellipsify(object index, int ndim):
33783  */
33784  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type);
33785  __pyx_r = __pyx_t_1;
33786  goto __pyx_L0;
33787 
33788  /* "View.MemoryView":663
33789  *
33790  * @cname('__pyx_memoryview_check')
33791  * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<<
33792  * return isinstance(o, memoryview)
33793  *
33794  */
33795 
33796  /* function exit code */
33797  __pyx_L0:;
33798  __Pyx_RefNannyFinishContext();
33799  return __pyx_r;
33800 }
33801 
33802 /* "View.MemoryView":666
33803  * return isinstance(o, memoryview)
33804  *
33805  * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<<
33806  * """
33807  * Replace all ellipses with full slices and fill incomplete indices with
33808  */
33809 
33810 static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
33811  PyObject *__pyx_v_tup = NULL;
33812  PyObject *__pyx_v_result = NULL;
33813  int __pyx_v_have_slices;
33814  int __pyx_v_seen_ellipsis;
33815  CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
33816  PyObject *__pyx_v_item = NULL;
33817  Py_ssize_t __pyx_v_nslices;
33818  PyObject *__pyx_r = NULL;
33819  __Pyx_RefNannyDeclarations
33820  int __pyx_t_1;
33821  int __pyx_t_2;
33822  PyObject *__pyx_t_3 = NULL;
33823  PyObject *__pyx_t_4 = NULL;
33824  Py_ssize_t __pyx_t_5;
33825  PyObject *(*__pyx_t_6)(PyObject *);
33826  PyObject *__pyx_t_7 = NULL;
33827  Py_ssize_t __pyx_t_8;
33828  int __pyx_t_9;
33829  int __pyx_t_10;
33830  PyObject *__pyx_t_11 = NULL;
33831  __Pyx_RefNannySetupContext("_unellipsify", 0);
33832 
33833  /* "View.MemoryView":671
33834  * full slices.
33835  * """
33836  * if not isinstance(index, tuple): # <<<<<<<<<<<<<<
33837  * tup = (index,)
33838  * else:
33839  */
33840  __pyx_t_1 = PyTuple_Check(__pyx_v_index);
33841  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
33842  if (__pyx_t_2) {
33843 
33844  /* "View.MemoryView":672
33845  * """
33846  * if not isinstance(index, tuple):
33847  * tup = (index,) # <<<<<<<<<<<<<<
33848  * else:
33849  * tup = index
33850  */
33851  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 672, __pyx_L1_error)
33852  __Pyx_GOTREF(__pyx_t_3);
33853  __Pyx_INCREF(__pyx_v_index);
33854  __Pyx_GIVEREF(__pyx_v_index);
33855  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
33856  __pyx_v_tup = __pyx_t_3;
33857  __pyx_t_3 = 0;
33858 
33859  /* "View.MemoryView":671
33860  * full slices.
33861  * """
33862  * if not isinstance(index, tuple): # <<<<<<<<<<<<<<
33863  * tup = (index,)
33864  * else:
33865  */
33866  goto __pyx_L3;
33867  }
33868 
33869  /* "View.MemoryView":674
33870  * tup = (index,)
33871  * else:
33872  * tup = index # <<<<<<<<<<<<<<
33873  *
33874  * result = []
33875  */
33876  /*else*/ {
33877  __Pyx_INCREF(__pyx_v_index);
33878  __pyx_v_tup = __pyx_v_index;
33879  }
33880  __pyx_L3:;
33881 
33882  /* "View.MemoryView":676
33883  * tup = index
33884  *
33885  * result = [] # <<<<<<<<<<<<<<
33886  * have_slices = False
33887  * seen_ellipsis = False
33888  */
33889  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 676, __pyx_L1_error)
33890  __Pyx_GOTREF(__pyx_t_3);
33891  __pyx_v_result = ((PyObject*)__pyx_t_3);
33892  __pyx_t_3 = 0;
33893 
33894  /* "View.MemoryView":677
33895  *
33896  * result = []
33897  * have_slices = False # <<<<<<<<<<<<<<
33898  * seen_ellipsis = False
33899  * for idx, item in enumerate(tup):
33900  */
33901  __pyx_v_have_slices = 0;
33902 
33903  /* "View.MemoryView":678
33904  * result = []
33905  * have_slices = False
33906  * seen_ellipsis = False # <<<<<<<<<<<<<<
33907  * for idx, item in enumerate(tup):
33908  * if item is Ellipsis:
33909  */
33910  __pyx_v_seen_ellipsis = 0;
33911 
33912  /* "View.MemoryView":679
33913  * have_slices = False
33914  * seen_ellipsis = False
33915  * for idx, item in enumerate(tup): # <<<<<<<<<<<<<<
33916  * if item is Ellipsis:
33917  * if not seen_ellipsis:
33918  */
33919  __Pyx_INCREF(__pyx_int_0);
33920  __pyx_t_3 = __pyx_int_0;
33921  if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) {
33922  __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
33923  __pyx_t_6 = NULL;
33924  } else {
33925  __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 679, __pyx_L1_error)
33926  __Pyx_GOTREF(__pyx_t_4);
33927  __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 679, __pyx_L1_error)
33928  }
33929  for (;;) {
33930  if (likely(!__pyx_t_6)) {
33931  if (likely(PyList_CheckExact(__pyx_t_4))) {
33932  if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
33933  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
33934  __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 679, __pyx_L1_error)
33935  #else
33936  __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 679, __pyx_L1_error)
33937  __Pyx_GOTREF(__pyx_t_7);
33938  #endif
33939  } else {
33940  if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
33941  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
33942  __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 679, __pyx_L1_error)
33943  #else
33944  __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 679, __pyx_L1_error)
33945  __Pyx_GOTREF(__pyx_t_7);
33946  #endif
33947  }
33948  } else {
33949  __pyx_t_7 = __pyx_t_6(__pyx_t_4);
33950  if (unlikely(!__pyx_t_7)) {
33951  PyObject* exc_type = PyErr_Occurred();
33952  if (exc_type) {
33953  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
33954  else __PYX_ERR(2, 679, __pyx_L1_error)
33955  }
33956  break;
33957  }
33958  __Pyx_GOTREF(__pyx_t_7);
33959  }
33960  __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
33961  __pyx_t_7 = 0;
33962  __Pyx_INCREF(__pyx_t_3);
33963  __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
33964  __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 679, __pyx_L1_error)
33965  __Pyx_GOTREF(__pyx_t_7);
33966  __Pyx_DECREF(__pyx_t_3);
33967  __pyx_t_3 = __pyx_t_7;
33968  __pyx_t_7 = 0;
33969 
33970  /* "View.MemoryView":680
33971  * seen_ellipsis = False
33972  * for idx, item in enumerate(tup):
33973  * if item is Ellipsis: # <<<<<<<<<<<<<<
33974  * if not seen_ellipsis:
33975  * result.extend([slice(None)] * (ndim - len(tup) + 1))
33976  */
33977  __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
33978  __pyx_t_1 = (__pyx_t_2 != 0);
33979  if (__pyx_t_1) {
33980 
33981  /* "View.MemoryView":681
33982  * for idx, item in enumerate(tup):
33983  * if item is Ellipsis:
33984  * if not seen_ellipsis: # <<<<<<<<<<<<<<
33985  * result.extend([slice(None)] * (ndim - len(tup) + 1))
33986  * seen_ellipsis = True
33987  */
33988  __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
33989  if (__pyx_t_1) {
33990 
33991  /* "View.MemoryView":682
33992  * if item is Ellipsis:
33993  * if not seen_ellipsis:
33994  * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<<
33995  * seen_ellipsis = True
33996  * else:
33997  */
33998  __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(2, 682, __pyx_L1_error)
33999  __pyx_t_7 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 682, __pyx_L1_error)
34000  __Pyx_GOTREF(__pyx_t_7);
34001  { Py_ssize_t __pyx_temp;
34002  for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) {
34003  __Pyx_INCREF(__pyx_slice__4);
34004  __Pyx_GIVEREF(__pyx_slice__4);
34005  PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__4);
34006  }
34007  }
34008  __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 682, __pyx_L1_error)
34009  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
34010 
34011  /* "View.MemoryView":683
34012  * if not seen_ellipsis:
34013  * result.extend([slice(None)] * (ndim - len(tup) + 1))
34014  * seen_ellipsis = True # <<<<<<<<<<<<<<
34015  * else:
34016  * result.append(slice(None))
34017  */
34018  __pyx_v_seen_ellipsis = 1;
34019 
34020  /* "View.MemoryView":681
34021  * for idx, item in enumerate(tup):
34022  * if item is Ellipsis:
34023  * if not seen_ellipsis: # <<<<<<<<<<<<<<
34024  * result.extend([slice(None)] * (ndim - len(tup) + 1))
34025  * seen_ellipsis = True
34026  */
34027  goto __pyx_L7;
34028  }
34029 
34030  /* "View.MemoryView":685
34031  * seen_ellipsis = True
34032  * else:
34033  * result.append(slice(None)) # <<<<<<<<<<<<<<
34034  * have_slices = True
34035  * else:
34036  */
34037  /*else*/ {
34038  __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__4); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 685, __pyx_L1_error)
34039  }
34040  __pyx_L7:;
34041 
34042  /* "View.MemoryView":686
34043  * else:
34044  * result.append(slice(None))
34045  * have_slices = True # <<<<<<<<<<<<<<
34046  * else:
34047  * if not isinstance(item, slice) and not PyIndex_Check(item):
34048  */
34049  __pyx_v_have_slices = 1;
34050 
34051  /* "View.MemoryView":680
34052  * seen_ellipsis = False
34053  * for idx, item in enumerate(tup):
34054  * if item is Ellipsis: # <<<<<<<<<<<<<<
34055  * if not seen_ellipsis:
34056  * result.extend([slice(None)] * (ndim - len(tup) + 1))
34057  */
34058  goto __pyx_L6;
34059  }
34060 
34061  /* "View.MemoryView":688
34062  * have_slices = True
34063  * else:
34064  * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<<
34065  * raise TypeError("Cannot index with type '%s'" % type(item))
34066  *
34067  */
34068  /*else*/ {
34069  __pyx_t_2 = PySlice_Check(__pyx_v_item);
34070  __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
34071  if (__pyx_t_10) {
34072  } else {
34073  __pyx_t_1 = __pyx_t_10;
34074  goto __pyx_L9_bool_binop_done;
34075  }
34076  __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0);
34077  __pyx_t_1 = __pyx_t_10;
34078  __pyx_L9_bool_binop_done:;
34079  if (unlikely(__pyx_t_1)) {
34080 
34081  /* "View.MemoryView":689
34082  * else:
34083  * if not isinstance(item, slice) and not PyIndex_Check(item):
34084  * raise TypeError("Cannot index with type '%s'" % type(item)) # <<<<<<<<<<<<<<
34085  *
34086  * have_slices = have_slices or isinstance(item, slice)
34087  */
34088  __pyx_t_7 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 689, __pyx_L1_error)
34089  __Pyx_GOTREF(__pyx_t_7);
34090  __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 689, __pyx_L1_error)
34091  __Pyx_GOTREF(__pyx_t_11);
34092  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
34093  __Pyx_Raise(__pyx_t_11, 0, 0, 0);
34094  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
34095  __PYX_ERR(2, 689, __pyx_L1_error)
34096 
34097  /* "View.MemoryView":688
34098  * have_slices = True
34099  * else:
34100  * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<<
34101  * raise TypeError("Cannot index with type '%s'" % type(item))
34102  *
34103  */
34104  }
34105 
34106  /* "View.MemoryView":691
34107  * raise TypeError("Cannot index with type '%s'" % type(item))
34108  *
34109  * have_slices = have_slices or isinstance(item, slice) # <<<<<<<<<<<<<<
34110  * result.append(item)
34111  *
34112  */
34113  __pyx_t_10 = (__pyx_v_have_slices != 0);
34114  if (!__pyx_t_10) {
34115  } else {
34116  __pyx_t_1 = __pyx_t_10;
34117  goto __pyx_L11_bool_binop_done;
34118  }
34119  __pyx_t_10 = PySlice_Check(__pyx_v_item);
34120  __pyx_t_2 = (__pyx_t_10 != 0);
34121  __pyx_t_1 = __pyx_t_2;
34122  __pyx_L11_bool_binop_done:;
34123  __pyx_v_have_slices = __pyx_t_1;
34124 
34125  /* "View.MemoryView":692
34126  *
34127  * have_slices = have_slices or isinstance(item, slice)
34128  * result.append(item) # <<<<<<<<<<<<<<
34129  *
34130  * nslices = ndim - len(result)
34131  */
34132  __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 692, __pyx_L1_error)
34133  }
34134  __pyx_L6:;
34135 
34136  /* "View.MemoryView":679
34137  * have_slices = False
34138  * seen_ellipsis = False
34139  * for idx, item in enumerate(tup): # <<<<<<<<<<<<<<
34140  * if item is Ellipsis:
34141  * if not seen_ellipsis:
34142  */
34143  }
34144  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
34145  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
34146 
34147  /* "View.MemoryView":694
34148  * result.append(item)
34149  *
34150  * nslices = ndim - len(result) # <<<<<<<<<<<<<<
34151  * if nslices:
34152  * result.extend([slice(None)] * nslices)
34153  */
34154  __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(2, 694, __pyx_L1_error)
34155  __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5);
34156 
34157  /* "View.MemoryView":695
34158  *
34159  * nslices = ndim - len(result)
34160  * if nslices: # <<<<<<<<<<<<<<
34161  * result.extend([slice(None)] * nslices)
34162  *
34163  */
34164  __pyx_t_1 = (__pyx_v_nslices != 0);
34165  if (__pyx_t_1) {
34166 
34167  /* "View.MemoryView":696
34168  * nslices = ndim - len(result)
34169  * if nslices:
34170  * result.extend([slice(None)] * nslices) # <<<<<<<<<<<<<<
34171  *
34172  * return have_slices or nslices, tuple(result)
34173  */
34174  __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 696, __pyx_L1_error)
34175  __Pyx_GOTREF(__pyx_t_3);
34176  { Py_ssize_t __pyx_temp;
34177  for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) {
34178  __Pyx_INCREF(__pyx_slice__4);
34179  __Pyx_GIVEREF(__pyx_slice__4);
34180  PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__4);
34181  }
34182  }
34183  __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 696, __pyx_L1_error)
34184  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
34185 
34186  /* "View.MemoryView":695
34187  *
34188  * nslices = ndim - len(result)
34189  * if nslices: # <<<<<<<<<<<<<<
34190  * result.extend([slice(None)] * nslices)
34191  *
34192  */
34193  }
34194 
34195  /* "View.MemoryView":698
34196  * result.extend([slice(None)] * nslices)
34197  *
34198  * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<<
34199  *
34200  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
34201  */
34202  __Pyx_XDECREF(__pyx_r);
34203  if (!__pyx_v_have_slices) {
34204  } else {
34205  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error)
34206  __Pyx_GOTREF(__pyx_t_4);
34207  __pyx_t_3 = __pyx_t_4;
34208  __pyx_t_4 = 0;
34209  goto __pyx_L14_bool_binop_done;
34210  }
34211  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error)
34212  __Pyx_GOTREF(__pyx_t_4);
34213  __pyx_t_3 = __pyx_t_4;
34214  __pyx_t_4 = 0;
34215  __pyx_L14_bool_binop_done:;
34216  __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error)
34217  __Pyx_GOTREF(__pyx_t_4);
34218  __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 698, __pyx_L1_error)
34219  __Pyx_GOTREF(__pyx_t_11);
34220  __Pyx_GIVEREF(__pyx_t_3);
34221  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
34222  __Pyx_GIVEREF(__pyx_t_4);
34223  PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
34224  __pyx_t_3 = 0;
34225  __pyx_t_4 = 0;
34226  __pyx_r = ((PyObject*)__pyx_t_11);
34227  __pyx_t_11 = 0;
34228  goto __pyx_L0;
34229 
34230  /* "View.MemoryView":666
34231  * return isinstance(o, memoryview)
34232  *
34233  * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<<
34234  * """
34235  * Replace all ellipses with full slices and fill incomplete indices with
34236  */
34237 
34238  /* function exit code */
34239  __pyx_L1_error:;
34240  __Pyx_XDECREF(__pyx_t_3);
34241  __Pyx_XDECREF(__pyx_t_4);
34242  __Pyx_XDECREF(__pyx_t_7);
34243  __Pyx_XDECREF(__pyx_t_11);
34244  __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
34245  __pyx_r = 0;
34246  __pyx_L0:;
34247  __Pyx_XDECREF(__pyx_v_tup);
34248  __Pyx_XDECREF(__pyx_v_result);
34249  __Pyx_XDECREF(__pyx_v_idx);
34250  __Pyx_XDECREF(__pyx_v_item);
34251  __Pyx_XGIVEREF(__pyx_r);
34252  __Pyx_RefNannyFinishContext();
34253  return __pyx_r;
34254 }
34255 
34256 /* "View.MemoryView":700
34257  * return have_slices or nslices, tuple(result)
34258  *
34259  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<<
34260  * for suboffset in suboffsets[:ndim]:
34261  * if suboffset >= 0:
34262  */
34263 
34264 static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) {
34265  Py_ssize_t __pyx_v_suboffset;
34266  PyObject *__pyx_r = NULL;
34267  __Pyx_RefNannyDeclarations
34268  Py_ssize_t *__pyx_t_1;
34269  Py_ssize_t *__pyx_t_2;
34270  Py_ssize_t *__pyx_t_3;
34271  int __pyx_t_4;
34272  PyObject *__pyx_t_5 = NULL;
34273  __Pyx_RefNannySetupContext("assert_direct_dimensions", 0);
34274 
34275  /* "View.MemoryView":701
34276  *
34277  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
34278  * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<<
34279  * if suboffset >= 0:
34280  * raise ValueError("Indirect dimensions not supported")
34281  */
34282  __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
34283  for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
34284  __pyx_t_1 = __pyx_t_3;
34285  __pyx_v_suboffset = (__pyx_t_1[0]);
34286 
34287  /* "View.MemoryView":702
34288  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
34289  * for suboffset in suboffsets[:ndim]:
34290  * if suboffset >= 0: # <<<<<<<<<<<<<<
34291  * raise ValueError("Indirect dimensions not supported")
34292  *
34293  */
34294  __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0);
34295  if (unlikely(__pyx_t_4)) {
34296 
34297  /* "View.MemoryView":703
34298  * for suboffset in suboffsets[:ndim]:
34299  * if suboffset >= 0:
34300  * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<<
34301  *
34302  *
34303  */
34304  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 703, __pyx_L1_error)
34305  __Pyx_GOTREF(__pyx_t_5);
34306  __Pyx_Raise(__pyx_t_5, 0, 0, 0);
34307  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
34308  __PYX_ERR(2, 703, __pyx_L1_error)
34309 
34310  /* "View.MemoryView":702
34311  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
34312  * for suboffset in suboffsets[:ndim]:
34313  * if suboffset >= 0: # <<<<<<<<<<<<<<
34314  * raise ValueError("Indirect dimensions not supported")
34315  *
34316  */
34317  }
34318  }
34319 
34320  /* "View.MemoryView":700
34321  * return have_slices or nslices, tuple(result)
34322  *
34323  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<<
34324  * for suboffset in suboffsets[:ndim]:
34325  * if suboffset >= 0:
34326  */
34327 
34328  /* function exit code */
34329  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
34330  goto __pyx_L0;
34331  __pyx_L1_error:;
34332  __Pyx_XDECREF(__pyx_t_5);
34333  __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
34334  __pyx_r = 0;
34335  __pyx_L0:;
34336  __Pyx_XGIVEREF(__pyx_r);
34337  __Pyx_RefNannyFinishContext();
34338  return __pyx_r;
34339 }
34340 
34341 /* "View.MemoryView":710
34342  *
34343  * @cname('__pyx_memview_slice')
34344  * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<<
34345  * cdef int new_ndim = 0, suboffset_dim = -1, dim
34346  * cdef bint negative_step
34347  */
34348 
34349 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
34350  int __pyx_v_new_ndim;
34351  int __pyx_v_suboffset_dim;
34352  int __pyx_v_dim;
34353  __Pyx_memviewslice __pyx_v_src;
34354  __Pyx_memviewslice __pyx_v_dst;
34355  __Pyx_memviewslice *__pyx_v_p_src;
34356  struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
34357  __Pyx_memviewslice *__pyx_v_p_dst;
34358  int *__pyx_v_p_suboffset_dim;
34359  Py_ssize_t __pyx_v_start;
34360  Py_ssize_t __pyx_v_stop;
34361  Py_ssize_t __pyx_v_step;
34362  int __pyx_v_have_start;
34363  int __pyx_v_have_stop;
34364  int __pyx_v_have_step;
34365  PyObject *__pyx_v_index = NULL;
34366  struct __pyx_memoryview_obj *__pyx_r = NULL;
34367  __Pyx_RefNannyDeclarations
34368  int __pyx_t_1;
34369  int __pyx_t_2;
34370  PyObject *__pyx_t_3 = NULL;
34371  struct __pyx_memoryview_obj *__pyx_t_4;
34372  char *__pyx_t_5;
34373  int __pyx_t_6;
34374  Py_ssize_t __pyx_t_7;
34375  PyObject *(*__pyx_t_8)(PyObject *);
34376  PyObject *__pyx_t_9 = NULL;
34377  Py_ssize_t __pyx_t_10;
34378  int __pyx_t_11;
34379  Py_ssize_t __pyx_t_12;
34380  __Pyx_RefNannySetupContext("memview_slice", 0);
34381 
34382  /* "View.MemoryView":711
34383  * @cname('__pyx_memview_slice')
34384  * cdef memoryview memview_slice(memoryview memview, object indices):
34385  * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<<
34386  * cdef bint negative_step
34387  * cdef __Pyx_memviewslice src, dst
34388  */
34389  __pyx_v_new_ndim = 0;
34390  __pyx_v_suboffset_dim = -1;
34391 
34392  /* "View.MemoryView":718
34393  *
34394  *
34395  * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<<
34396  *
34397  * cdef _memoryviewslice memviewsliceobj
34398  */
34399  (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst))));
34400 
34401  /* "View.MemoryView":722
34402  * cdef _memoryviewslice memviewsliceobj
34403  *
34404  * assert memview.view.ndim > 0 # <<<<<<<<<<<<<<
34405  *
34406  * if isinstance(memview, _memoryviewslice):
34407  */
34408  #ifndef CYTHON_WITHOUT_ASSERTIONS
34409  if (unlikely(!Py_OptimizeFlag)) {
34410  if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
34411  PyErr_SetNone(PyExc_AssertionError);
34412  __PYX_ERR(2, 722, __pyx_L1_error)
34413  }
34414  }
34415  #endif
34416 
34417  /* "View.MemoryView":724
34418  * assert memview.view.ndim > 0
34419  *
34420  * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
34421  * memviewsliceobj = memview
34422  * p_src = &memviewsliceobj.from_slice
34423  */
34424  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
34425  __pyx_t_2 = (__pyx_t_1 != 0);
34426  if (__pyx_t_2) {
34427 
34428  /* "View.MemoryView":725
34429  *
34430  * if isinstance(memview, _memoryviewslice):
34431  * memviewsliceobj = memview # <<<<<<<<<<<<<<
34432  * p_src = &memviewsliceobj.from_slice
34433  * else:
34434  */
34435  if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 725, __pyx_L1_error)
34436  __pyx_t_3 = ((PyObject *)__pyx_v_memview);
34437  __Pyx_INCREF(__pyx_t_3);
34438  __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
34439  __pyx_t_3 = 0;
34440 
34441  /* "View.MemoryView":726
34442  * if isinstance(memview, _memoryviewslice):
34443  * memviewsliceobj = memview
34444  * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<<
34445  * else:
34446  * slice_copy(memview, &src)
34447  */
34448  __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);
34449 
34450  /* "View.MemoryView":724
34451  * assert memview.view.ndim > 0
34452  *
34453  * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
34454  * memviewsliceobj = memview
34455  * p_src = &memviewsliceobj.from_slice
34456  */
34457  goto __pyx_L3;
34458  }
34459 
34460  /* "View.MemoryView":728
34461  * p_src = &memviewsliceobj.from_slice
34462  * else:
34463  * slice_copy(memview, &src) # <<<<<<<<<<<<<<
34464  * p_src = &src
34465  *
34466  */
34467  /*else*/ {
34468  __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));
34469 
34470  /* "View.MemoryView":729
34471  * else:
34472  * slice_copy(memview, &src)
34473  * p_src = &src # <<<<<<<<<<<<<<
34474  *
34475  *
34476  */
34477  __pyx_v_p_src = (&__pyx_v_src);
34478  }
34479  __pyx_L3:;
34480 
34481  /* "View.MemoryView":735
34482  *
34483  *
34484  * dst.memview = p_src.memview # <<<<<<<<<<<<<<
34485  * dst.data = p_src.data
34486  *
34487  */
34488  __pyx_t_4 = __pyx_v_p_src->memview;
34489  __pyx_v_dst.memview = __pyx_t_4;
34490 
34491  /* "View.MemoryView":736
34492  *
34493  * dst.memview = p_src.memview
34494  * dst.data = p_src.data # <<<<<<<<<<<<<<
34495  *
34496  *
34497  */
34498  __pyx_t_5 = __pyx_v_p_src->data;
34499  __pyx_v_dst.data = __pyx_t_5;
34500 
34501  /* "View.MemoryView":741
34502  *
34503  *
34504  * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<<
34505  * cdef int *p_suboffset_dim = &suboffset_dim
34506  * cdef Py_ssize_t start, stop, step
34507  */
34508  __pyx_v_p_dst = (&__pyx_v_dst);
34509 
34510  /* "View.MemoryView":742
34511  *
34512  * cdef __Pyx_memviewslice *p_dst = &dst
34513  * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<<
34514  * cdef Py_ssize_t start, stop, step
34515  * cdef bint have_start, have_stop, have_step
34516  */
34517  __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);
34518 
34519  /* "View.MemoryView":746
34520  * cdef bint have_start, have_stop, have_step
34521  *
34522  * for dim, index in enumerate(indices): # <<<<<<<<<<<<<<
34523  * if PyIndex_Check(index):
34524  * slice_memviewslice(
34525  */
34526  __pyx_t_6 = 0;
34527  if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
34528  __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
34529  __pyx_t_8 = NULL;
34530  } else {
34531  __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 746, __pyx_L1_error)
34532  __Pyx_GOTREF(__pyx_t_3);
34533  __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 746, __pyx_L1_error)
34534  }
34535  for (;;) {
34536  if (likely(!__pyx_t_8)) {
34537  if (likely(PyList_CheckExact(__pyx_t_3))) {
34538  if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
34539  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
34540  __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 746, __pyx_L1_error)
34541  #else
34542  __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 746, __pyx_L1_error)
34543  __Pyx_GOTREF(__pyx_t_9);
34544  #endif
34545  } else {
34546  if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
34547  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
34548  __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 746, __pyx_L1_error)
34549  #else
34550  __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 746, __pyx_L1_error)
34551  __Pyx_GOTREF(__pyx_t_9);
34552  #endif
34553  }
34554  } else {
34555  __pyx_t_9 = __pyx_t_8(__pyx_t_3);
34556  if (unlikely(!__pyx_t_9)) {
34557  PyObject* exc_type = PyErr_Occurred();
34558  if (exc_type) {
34559  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
34560  else __PYX_ERR(2, 746, __pyx_L1_error)
34561  }
34562  break;
34563  }
34564  __Pyx_GOTREF(__pyx_t_9);
34565  }
34566  __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
34567  __pyx_t_9 = 0;
34568  __pyx_v_dim = __pyx_t_6;
34569  __pyx_t_6 = (__pyx_t_6 + 1);
34570 
34571  /* "View.MemoryView":747
34572  *
34573  * for dim, index in enumerate(indices):
34574  * if PyIndex_Check(index): # <<<<<<<<<<<<<<
34575  * slice_memviewslice(
34576  * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
34577  */
34578  __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0);
34579  if (__pyx_t_2) {
34580 
34581  /* "View.MemoryView":751
34582  * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
34583  * dim, new_ndim, p_suboffset_dim,
34584  * index, 0, 0, # start, stop, step # <<<<<<<<<<<<<<
34585  * 0, 0, 0, # have_{start,stop,step}
34586  * False)
34587  */
34588  __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 751, __pyx_L1_error)
34589 
34590  /* "View.MemoryView":748
34591  * for dim, index in enumerate(indices):
34592  * if PyIndex_Check(index):
34593  * slice_memviewslice( # <<<<<<<<<<<<<<
34594  * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
34595  * dim, new_ndim, p_suboffset_dim,
34596  */
34597  __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 748, __pyx_L1_error)
34598 
34599  /* "View.MemoryView":747
34600  *
34601  * for dim, index in enumerate(indices):
34602  * if PyIndex_Check(index): # <<<<<<<<<<<<<<
34603  * slice_memviewslice(
34604  * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
34605  */
34606  goto __pyx_L6;
34607  }
34608 
34609  /* "View.MemoryView":754
34610  * 0, 0, 0, # have_{start,stop,step}
34611  * False)
34612  * elif index is None: # <<<<<<<<<<<<<<
34613  * p_dst.shape[new_ndim] = 1
34614  * p_dst.strides[new_ndim] = 0
34615  */
34616  __pyx_t_2 = (__pyx_v_index == Py_None);
34617  __pyx_t_1 = (__pyx_t_2 != 0);
34618  if (__pyx_t_1) {
34619 
34620  /* "View.MemoryView":755
34621  * False)
34622  * elif index is None:
34623  * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<<
34624  * p_dst.strides[new_ndim] = 0
34625  * p_dst.suboffsets[new_ndim] = -1
34626  */
34627  (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;
34628 
34629  /* "View.MemoryView":756
34630  * elif index is None:
34631  * p_dst.shape[new_ndim] = 1
34632  * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<<
34633  * p_dst.suboffsets[new_ndim] = -1
34634  * new_ndim += 1
34635  */
34636  (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;
34637 
34638  /* "View.MemoryView":757
34639  * p_dst.shape[new_ndim] = 1
34640  * p_dst.strides[new_ndim] = 0
34641  * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<<
34642  * new_ndim += 1
34643  * else:
34644  */
34645  (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L;
34646 
34647  /* "View.MemoryView":758
34648  * p_dst.strides[new_ndim] = 0
34649  * p_dst.suboffsets[new_ndim] = -1
34650  * new_ndim += 1 # <<<<<<<<<<<<<<
34651  * else:
34652  * start = index.start or 0
34653  */
34654  __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
34655 
34656  /* "View.MemoryView":754
34657  * 0, 0, 0, # have_{start,stop,step}
34658  * False)
34659  * elif index is None: # <<<<<<<<<<<<<<
34660  * p_dst.shape[new_ndim] = 1
34661  * p_dst.strides[new_ndim] = 0
34662  */
34663  goto __pyx_L6;
34664  }
34665 
34666  /* "View.MemoryView":760
34667  * new_ndim += 1
34668  * else:
34669  * start = index.start or 0 # <<<<<<<<<<<<<<
34670  * stop = index.stop or 0
34671  * step = index.step or 0
34672  */
34673  /*else*/ {
34674  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 760, __pyx_L1_error)
34675  __Pyx_GOTREF(__pyx_t_9);
34676  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 760, __pyx_L1_error)
34677  if (!__pyx_t_1) {
34678  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
34679  } else {
34680  __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 760, __pyx_L1_error)
34681  __pyx_t_10 = __pyx_t_12;
34682  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
34683  goto __pyx_L7_bool_binop_done;
34684  }
34685  __pyx_t_10 = 0;
34686  __pyx_L7_bool_binop_done:;
34687  __pyx_v_start = __pyx_t_10;
34688 
34689  /* "View.MemoryView":761
34690  * else:
34691  * start = index.start or 0
34692  * stop = index.stop or 0 # <<<<<<<<<<<<<<
34693  * step = index.step or 0
34694  *
34695  */
34696  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 761, __pyx_L1_error)
34697  __Pyx_GOTREF(__pyx_t_9);
34698  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 761, __pyx_L1_error)
34699  if (!__pyx_t_1) {
34700  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
34701  } else {
34702  __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 761, __pyx_L1_error)
34703  __pyx_t_10 = __pyx_t_12;
34704  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
34705  goto __pyx_L9_bool_binop_done;
34706  }
34707  __pyx_t_10 = 0;
34708  __pyx_L9_bool_binop_done:;
34709  __pyx_v_stop = __pyx_t_10;
34710 
34711  /* "View.MemoryView":762
34712  * start = index.start or 0
34713  * stop = index.stop or 0
34714  * step = index.step or 0 # <<<<<<<<<<<<<<
34715  *
34716  * have_start = index.start is not None
34717  */
34718  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 762, __pyx_L1_error)
34719  __Pyx_GOTREF(__pyx_t_9);
34720  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 762, __pyx_L1_error)
34721  if (!__pyx_t_1) {
34722  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
34723  } else {
34724  __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 762, __pyx_L1_error)
34725  __pyx_t_10 = __pyx_t_12;
34726  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
34727  goto __pyx_L11_bool_binop_done;
34728  }
34729  __pyx_t_10 = 0;
34730  __pyx_L11_bool_binop_done:;
34731  __pyx_v_step = __pyx_t_10;
34732 
34733  /* "View.MemoryView":764
34734  * step = index.step or 0
34735  *
34736  * have_start = index.start is not None # <<<<<<<<<<<<<<
34737  * have_stop = index.stop is not None
34738  * have_step = index.step is not None
34739  */
34740  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 764, __pyx_L1_error)
34741  __Pyx_GOTREF(__pyx_t_9);
34742  __pyx_t_1 = (__pyx_t_9 != Py_None);
34743  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
34744  __pyx_v_have_start = __pyx_t_1;
34745 
34746  /* "View.MemoryView":765
34747  *
34748  * have_start = index.start is not None
34749  * have_stop = index.stop is not None # <<<<<<<<<<<<<<
34750  * have_step = index.step is not None
34751  *
34752  */
34753  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 765, __pyx_L1_error)
34754  __Pyx_GOTREF(__pyx_t_9);
34755  __pyx_t_1 = (__pyx_t_9 != Py_None);
34756  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
34757  __pyx_v_have_stop = __pyx_t_1;
34758 
34759  /* "View.MemoryView":766
34760  * have_start = index.start is not None
34761  * have_stop = index.stop is not None
34762  * have_step = index.step is not None # <<<<<<<<<<<<<<
34763  *
34764  * slice_memviewslice(
34765  */
34766  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 766, __pyx_L1_error)
34767  __Pyx_GOTREF(__pyx_t_9);
34768  __pyx_t_1 = (__pyx_t_9 != Py_None);
34769  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
34770  __pyx_v_have_step = __pyx_t_1;
34771 
34772  /* "View.MemoryView":768
34773  * have_step = index.step is not None
34774  *
34775  * slice_memviewslice( # <<<<<<<<<<<<<<
34776  * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
34777  * dim, new_ndim, p_suboffset_dim,
34778  */
34779  __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 768, __pyx_L1_error)
34780 
34781  /* "View.MemoryView":774
34782  * have_start, have_stop, have_step,
34783  * True)
34784  * new_ndim += 1 # <<<<<<<<<<<<<<
34785  *
34786  * if isinstance(memview, _memoryviewslice):
34787  */
34788  __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
34789  }
34790  __pyx_L6:;
34791 
34792  /* "View.MemoryView":746
34793  * cdef bint have_start, have_stop, have_step
34794  *
34795  * for dim, index in enumerate(indices): # <<<<<<<<<<<<<<
34796  * if PyIndex_Check(index):
34797  * slice_memviewslice(
34798  */
34799  }
34800  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
34801 
34802  /* "View.MemoryView":776
34803  * new_ndim += 1
34804  *
34805  * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
34806  * return memoryview_fromslice(dst, new_ndim,
34807  * memviewsliceobj.to_object_func,
34808  */
34809  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
34810  __pyx_t_2 = (__pyx_t_1 != 0);
34811  if (__pyx_t_2) {
34812 
34813  /* "View.MemoryView":777
34814  *
34815  * if isinstance(memview, _memoryviewslice):
34816  * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<<
34817  * memviewsliceobj.to_object_func,
34818  * memviewsliceobj.to_dtype_func,
34819  */
34820  __Pyx_XDECREF(((PyObject *)__pyx_r));
34821 
34822  /* "View.MemoryView":778
34823  * if isinstance(memview, _memoryviewslice):
34824  * return memoryview_fromslice(dst, new_ndim,
34825  * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<<
34826  * memviewsliceobj.to_dtype_func,
34827  * memview.dtype_is_object)
34828  */
34829  if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 778, __pyx_L1_error) }
34830 
34831  /* "View.MemoryView":779
34832  * return memoryview_fromslice(dst, new_ndim,
34833  * memviewsliceobj.to_object_func,
34834  * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<<
34835  * memview.dtype_is_object)
34836  * else:
34837  */
34838  if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 779, __pyx_L1_error) }
34839 
34840  /* "View.MemoryView":777
34841  *
34842  * if isinstance(memview, _memoryviewslice):
34843  * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<<
34844  * memviewsliceobj.to_object_func,
34845  * memviewsliceobj.to_dtype_func,
34846  */
34847  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 777, __pyx_L1_error)
34848  __Pyx_GOTREF(__pyx_t_3);
34849  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 777, __pyx_L1_error)
34850  __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
34851  __pyx_t_3 = 0;
34852  goto __pyx_L0;
34853 
34854  /* "View.MemoryView":776
34855  * new_ndim += 1
34856  *
34857  * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
34858  * return memoryview_fromslice(dst, new_ndim,
34859  * memviewsliceobj.to_object_func,
34860  */
34861  }
34862 
34863  /* "View.MemoryView":782
34864  * memview.dtype_is_object)
34865  * else:
34866  * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<<
34867  * memview.dtype_is_object)
34868  *
34869  */
34870  /*else*/ {
34871  __Pyx_XDECREF(((PyObject *)__pyx_r));
34872 
34873  /* "View.MemoryView":783
34874  * else:
34875  * return memoryview_fromslice(dst, new_ndim, NULL, NULL,
34876  * memview.dtype_is_object) # <<<<<<<<<<<<<<
34877  *
34878  *
34879  */
34880  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 782, __pyx_L1_error)
34881  __Pyx_GOTREF(__pyx_t_3);
34882 
34883  /* "View.MemoryView":782
34884  * memview.dtype_is_object)
34885  * else:
34886  * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<<
34887  * memview.dtype_is_object)
34888  *
34889  */
34890  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 782, __pyx_L1_error)
34891  __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
34892  __pyx_t_3 = 0;
34893  goto __pyx_L0;
34894  }
34895 
34896  /* "View.MemoryView":710
34897  *
34898  * @cname('__pyx_memview_slice')
34899  * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<<
34900  * cdef int new_ndim = 0, suboffset_dim = -1, dim
34901  * cdef bint negative_step
34902  */
34903 
34904  /* function exit code */
34905  __pyx_L1_error:;
34906  __Pyx_XDECREF(__pyx_t_3);
34907  __Pyx_XDECREF(__pyx_t_9);
34908  __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
34909  __pyx_r = 0;
34910  __pyx_L0:;
34911  __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
34912  __Pyx_XDECREF(__pyx_v_index);
34913  __Pyx_XGIVEREF((PyObject *)__pyx_r);
34914  __Pyx_RefNannyFinishContext();
34915  return __pyx_r;
34916 }
34917 
34918 /* "View.MemoryView":807
34919  *
34920  * @cname('__pyx_memoryview_slice_memviewslice')
34921  * cdef int slice_memviewslice( # <<<<<<<<<<<<<<
34922  * __Pyx_memviewslice *dst,
34923  * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
34924  */
34925 
34926 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) {
34927  Py_ssize_t __pyx_v_new_shape;
34928  int __pyx_v_negative_step;
34929  int __pyx_r;
34930  int __pyx_t_1;
34931  int __pyx_t_2;
34932  int __pyx_t_3;
34933 
34934  /* "View.MemoryView":827
34935  * cdef bint negative_step
34936  *
34937  * if not is_slice: # <<<<<<<<<<<<<<
34938  *
34939  * if start < 0:
34940  */
34941  __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
34942  if (__pyx_t_1) {
34943 
34944  /* "View.MemoryView":829
34945  * if not is_slice:
34946  *
34947  * if start < 0: # <<<<<<<<<<<<<<
34948  * start += shape
34949  * if not 0 <= start < shape:
34950  */
34951  __pyx_t_1 = ((__pyx_v_start < 0) != 0);
34952  if (__pyx_t_1) {
34953 
34954  /* "View.MemoryView":830
34955  *
34956  * if start < 0:
34957  * start += shape # <<<<<<<<<<<<<<
34958  * if not 0 <= start < shape:
34959  * _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
34960  */
34961  __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
34962 
34963  /* "View.MemoryView":829
34964  * if not is_slice:
34965  *
34966  * if start < 0: # <<<<<<<<<<<<<<
34967  * start += shape
34968  * if not 0 <= start < shape:
34969  */
34970  }
34971 
34972  /* "View.MemoryView":831
34973  * if start < 0:
34974  * start += shape
34975  * if not 0 <= start < shape: # <<<<<<<<<<<<<<
34976  * _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
34977  * else:
34978  */
34979  __pyx_t_1 = (0 <= __pyx_v_start);
34980  if (__pyx_t_1) {
34981  __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
34982  }
34983  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
34984  if (__pyx_t_2) {
34985 
34986  /* "View.MemoryView":832
34987  * start += shape
34988  * if not 0 <= start < shape:
34989  * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<<
34990  * else:
34991  *
34992  */
34993  __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"Index out of bounds (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 832, __pyx_L1_error)
34994 
34995  /* "View.MemoryView":831
34996  * if start < 0:
34997  * start += shape
34998  * if not 0 <= start < shape: # <<<<<<<<<<<<<<
34999  * _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
35000  * else:
35001  */
35002  }
35003 
35004  /* "View.MemoryView":827
35005  * cdef bint negative_step
35006  *
35007  * if not is_slice: # <<<<<<<<<<<<<<
35008  *
35009  * if start < 0:
35010  */
35011  goto __pyx_L3;
35012  }
35013 
35014  /* "View.MemoryView":835
35015  * else:
35016  *
35017  * negative_step = have_step != 0 and step < 0 # <<<<<<<<<<<<<<
35018  *
35019  * if have_step and step == 0:
35020  */
35021  /*else*/ {
35022  __pyx_t_1 = ((__pyx_v_have_step != 0) != 0);
35023  if (__pyx_t_1) {
35024  } else {
35025  __pyx_t_2 = __pyx_t_1;
35026  goto __pyx_L6_bool_binop_done;
35027  }
35028  __pyx_t_1 = ((__pyx_v_step < 0) != 0);
35029  __pyx_t_2 = __pyx_t_1;
35030  __pyx_L6_bool_binop_done:;
35031  __pyx_v_negative_step = __pyx_t_2;
35032 
35033  /* "View.MemoryView":837
35034  * negative_step = have_step != 0 and step < 0
35035  *
35036  * if have_step and step == 0: # <<<<<<<<<<<<<<
35037  * _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
35038  *
35039  */
35040  __pyx_t_1 = (__pyx_v_have_step != 0);
35041  if (__pyx_t_1) {
35042  } else {
35043  __pyx_t_2 = __pyx_t_1;
35044  goto __pyx_L9_bool_binop_done;
35045  }
35046  __pyx_t_1 = ((__pyx_v_step == 0) != 0);
35047  __pyx_t_2 = __pyx_t_1;
35048  __pyx_L9_bool_binop_done:;
35049  if (__pyx_t_2) {
35050 
35051  /* "View.MemoryView":838
35052  *
35053  * if have_step and step == 0:
35054  * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<<
35055  *
35056  *
35057  */
35058  __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Step may not be zero (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 838, __pyx_L1_error)
35059 
35060  /* "View.MemoryView":837
35061  * negative_step = have_step != 0 and step < 0
35062  *
35063  * if have_step and step == 0: # <<<<<<<<<<<<<<
35064  * _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
35065  *
35066  */
35067  }
35068 
35069  /* "View.MemoryView":841
35070  *
35071  *
35072  * if have_start: # <<<<<<<<<<<<<<
35073  * if start < 0:
35074  * start += shape
35075  */
35076  __pyx_t_2 = (__pyx_v_have_start != 0);
35077  if (__pyx_t_2) {
35078 
35079  /* "View.MemoryView":842
35080  *
35081  * if have_start:
35082  * if start < 0: # <<<<<<<<<<<<<<
35083  * start += shape
35084  * if start < 0:
35085  */
35086  __pyx_t_2 = ((__pyx_v_start < 0) != 0);
35087  if (__pyx_t_2) {
35088 
35089  /* "View.MemoryView":843
35090  * if have_start:
35091  * if start < 0:
35092  * start += shape # <<<<<<<<<<<<<<
35093  * if start < 0:
35094  * start = 0
35095  */
35096  __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
35097 
35098  /* "View.MemoryView":844
35099  * if start < 0:
35100  * start += shape
35101  * if start < 0: # <<<<<<<<<<<<<<
35102  * start = 0
35103  * elif start >= shape:
35104  */
35105  __pyx_t_2 = ((__pyx_v_start < 0) != 0);
35106  if (__pyx_t_2) {
35107 
35108  /* "View.MemoryView":845
35109  * start += shape
35110  * if start < 0:
35111  * start = 0 # <<<<<<<<<<<<<<
35112  * elif start >= shape:
35113  * if negative_step:
35114  */
35115  __pyx_v_start = 0;
35116 
35117  /* "View.MemoryView":844
35118  * if start < 0:
35119  * start += shape
35120  * if start < 0: # <<<<<<<<<<<<<<
35121  * start = 0
35122  * elif start >= shape:
35123  */
35124  }
35125 
35126  /* "View.MemoryView":842
35127  *
35128  * if have_start:
35129  * if start < 0: # <<<<<<<<<<<<<<
35130  * start += shape
35131  * if start < 0:
35132  */
35133  goto __pyx_L12;
35134  }
35135 
35136  /* "View.MemoryView":846
35137  * if start < 0:
35138  * start = 0
35139  * elif start >= shape: # <<<<<<<<<<<<<<
35140  * if negative_step:
35141  * start = shape - 1
35142  */
35143  __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
35144  if (__pyx_t_2) {
35145 
35146  /* "View.MemoryView":847
35147  * start = 0
35148  * elif start >= shape:
35149  * if negative_step: # <<<<<<<<<<<<<<
35150  * start = shape - 1
35151  * else:
35152  */
35153  __pyx_t_2 = (__pyx_v_negative_step != 0);
35154  if (__pyx_t_2) {
35155 
35156  /* "View.MemoryView":848
35157  * elif start >= shape:
35158  * if negative_step:
35159  * start = shape - 1 # <<<<<<<<<<<<<<
35160  * else:
35161  * start = shape
35162  */
35163  __pyx_v_start = (__pyx_v_shape - 1);
35164 
35165  /* "View.MemoryView":847
35166  * start = 0
35167  * elif start >= shape:
35168  * if negative_step: # <<<<<<<<<<<<<<
35169  * start = shape - 1
35170  * else:
35171  */
35172  goto __pyx_L14;
35173  }
35174 
35175  /* "View.MemoryView":850
35176  * start = shape - 1
35177  * else:
35178  * start = shape # <<<<<<<<<<<<<<
35179  * else:
35180  * if negative_step:
35181  */
35182  /*else*/ {
35183  __pyx_v_start = __pyx_v_shape;
35184  }
35185  __pyx_L14:;
35186 
35187  /* "View.MemoryView":846
35188  * if start < 0:
35189  * start = 0
35190  * elif start >= shape: # <<<<<<<<<<<<<<
35191  * if negative_step:
35192  * start = shape - 1
35193  */
35194  }
35195  __pyx_L12:;
35196 
35197  /* "View.MemoryView":841
35198  *
35199  *
35200  * if have_start: # <<<<<<<<<<<<<<
35201  * if start < 0:
35202  * start += shape
35203  */
35204  goto __pyx_L11;
35205  }
35206 
35207  /* "View.MemoryView":852
35208  * start = shape
35209  * else:
35210  * if negative_step: # <<<<<<<<<<<<<<
35211  * start = shape - 1
35212  * else:
35213  */
35214  /*else*/ {
35215  __pyx_t_2 = (__pyx_v_negative_step != 0);
35216  if (__pyx_t_2) {
35217 
35218  /* "View.MemoryView":853
35219  * else:
35220  * if negative_step:
35221  * start = shape - 1 # <<<<<<<<<<<<<<
35222  * else:
35223  * start = 0
35224  */
35225  __pyx_v_start = (__pyx_v_shape - 1);
35226 
35227  /* "View.MemoryView":852
35228  * start = shape
35229  * else:
35230  * if negative_step: # <<<<<<<<<<<<<<
35231  * start = shape - 1
35232  * else:
35233  */
35234  goto __pyx_L15;
35235  }
35236 
35237  /* "View.MemoryView":855
35238  * start = shape - 1
35239  * else:
35240  * start = 0 # <<<<<<<<<<<<<<
35241  *
35242  * if have_stop:
35243  */
35244  /*else*/ {
35245  __pyx_v_start = 0;
35246  }
35247  __pyx_L15:;
35248  }
35249  __pyx_L11:;
35250 
35251  /* "View.MemoryView":857
35252  * start = 0
35253  *
35254  * if have_stop: # <<<<<<<<<<<<<<
35255  * if stop < 0:
35256  * stop += shape
35257  */
35258  __pyx_t_2 = (__pyx_v_have_stop != 0);
35259  if (__pyx_t_2) {
35260 
35261  /* "View.MemoryView":858
35262  *
35263  * if have_stop:
35264  * if stop < 0: # <<<<<<<<<<<<<<
35265  * stop += shape
35266  * if stop < 0:
35267  */
35268  __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
35269  if (__pyx_t_2) {
35270 
35271  /* "View.MemoryView":859
35272  * if have_stop:
35273  * if stop < 0:
35274  * stop += shape # <<<<<<<<<<<<<<
35275  * if stop < 0:
35276  * stop = 0
35277  */
35278  __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);
35279 
35280  /* "View.MemoryView":860
35281  * if stop < 0:
35282  * stop += shape
35283  * if stop < 0: # <<<<<<<<<<<<<<
35284  * stop = 0
35285  * elif stop > shape:
35286  */
35287  __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
35288  if (__pyx_t_2) {
35289 
35290  /* "View.MemoryView":861
35291  * stop += shape
35292  * if stop < 0:
35293  * stop = 0 # <<<<<<<<<<<<<<
35294  * elif stop > shape:
35295  * stop = shape
35296  */
35297  __pyx_v_stop = 0;
35298 
35299  /* "View.MemoryView":860
35300  * if stop < 0:
35301  * stop += shape
35302  * if stop < 0: # <<<<<<<<<<<<<<
35303  * stop = 0
35304  * elif stop > shape:
35305  */
35306  }
35307 
35308  /* "View.MemoryView":858
35309  *
35310  * if have_stop:
35311  * if stop < 0: # <<<<<<<<<<<<<<
35312  * stop += shape
35313  * if stop < 0:
35314  */
35315  goto __pyx_L17;
35316  }
35317 
35318  /* "View.MemoryView":862
35319  * if stop < 0:
35320  * stop = 0
35321  * elif stop > shape: # <<<<<<<<<<<<<<
35322  * stop = shape
35323  * else:
35324  */
35325  __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
35326  if (__pyx_t_2) {
35327 
35328  /* "View.MemoryView":863
35329  * stop = 0
35330  * elif stop > shape:
35331  * stop = shape # <<<<<<<<<<<<<<
35332  * else:
35333  * if negative_step:
35334  */
35335  __pyx_v_stop = __pyx_v_shape;
35336 
35337  /* "View.MemoryView":862
35338  * if stop < 0:
35339  * stop = 0
35340  * elif stop > shape: # <<<<<<<<<<<<<<
35341  * stop = shape
35342  * else:
35343  */
35344  }
35345  __pyx_L17:;
35346 
35347  /* "View.MemoryView":857
35348  * start = 0
35349  *
35350  * if have_stop: # <<<<<<<<<<<<<<
35351  * if stop < 0:
35352  * stop += shape
35353  */
35354  goto __pyx_L16;
35355  }
35356 
35357  /* "View.MemoryView":865
35358  * stop = shape
35359  * else:
35360  * if negative_step: # <<<<<<<<<<<<<<
35361  * stop = -1
35362  * else:
35363  */
35364  /*else*/ {
35365  __pyx_t_2 = (__pyx_v_negative_step != 0);
35366  if (__pyx_t_2) {
35367 
35368  /* "View.MemoryView":866
35369  * else:
35370  * if negative_step:
35371  * stop = -1 # <<<<<<<<<<<<<<
35372  * else:
35373  * stop = shape
35374  */
35375  __pyx_v_stop = -1L;
35376 
35377  /* "View.MemoryView":865
35378  * stop = shape
35379  * else:
35380  * if negative_step: # <<<<<<<<<<<<<<
35381  * stop = -1
35382  * else:
35383  */
35384  goto __pyx_L19;
35385  }
35386 
35387  /* "View.MemoryView":868
35388  * stop = -1
35389  * else:
35390  * stop = shape # <<<<<<<<<<<<<<
35391  *
35392  * if not have_step:
35393  */
35394  /*else*/ {
35395  __pyx_v_stop = __pyx_v_shape;
35396  }
35397  __pyx_L19:;
35398  }
35399  __pyx_L16:;
35400 
35401  /* "View.MemoryView":870
35402  * stop = shape
35403  *
35404  * if not have_step: # <<<<<<<<<<<<<<
35405  * step = 1
35406  *
35407  */
35408  __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
35409  if (__pyx_t_2) {
35410 
35411  /* "View.MemoryView":871
35412  *
35413  * if not have_step:
35414  * step = 1 # <<<<<<<<<<<<<<
35415  *
35416  *
35417  */
35418  __pyx_v_step = 1;
35419 
35420  /* "View.MemoryView":870
35421  * stop = shape
35422  *
35423  * if not have_step: # <<<<<<<<<<<<<<
35424  * step = 1
35425  *
35426  */
35427  }
35428 
35429  /* "View.MemoryView":875
35430  *
35431  * with cython.cdivision(True):
35432  * new_shape = (stop - start) // step # <<<<<<<<<<<<<<
35433  *
35434  * if (stop - start) - step * new_shape:
35435  */
35436  __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
35437 
35438  /* "View.MemoryView":877
35439  * new_shape = (stop - start) // step
35440  *
35441  * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<<
35442  * new_shape += 1
35443  *
35444  */
35445  __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
35446  if (__pyx_t_2) {
35447 
35448  /* "View.MemoryView":878
35449  *
35450  * if (stop - start) - step * new_shape:
35451  * new_shape += 1 # <<<<<<<<<<<<<<
35452  *
35453  * if new_shape < 0:
35454  */
35455  __pyx_v_new_shape = (__pyx_v_new_shape + 1);
35456 
35457  /* "View.MemoryView":877
35458  * new_shape = (stop - start) // step
35459  *
35460  * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<<
35461  * new_shape += 1
35462  *
35463  */
35464  }
35465 
35466  /* "View.MemoryView":880
35467  * new_shape += 1
35468  *
35469  * if new_shape < 0: # <<<<<<<<<<<<<<
35470  * new_shape = 0
35471  *
35472  */
35473  __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
35474  if (__pyx_t_2) {
35475 
35476  /* "View.MemoryView":881
35477  *
35478  * if new_shape < 0:
35479  * new_shape = 0 # <<<<<<<<<<<<<<
35480  *
35481  *
35482  */
35483  __pyx_v_new_shape = 0;
35484 
35485  /* "View.MemoryView":880
35486  * new_shape += 1
35487  *
35488  * if new_shape < 0: # <<<<<<<<<<<<<<
35489  * new_shape = 0
35490  *
35491  */
35492  }
35493 
35494  /* "View.MemoryView":884
35495  *
35496  *
35497  * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<<
35498  * dst.shape[new_ndim] = new_shape
35499  * dst.suboffsets[new_ndim] = suboffset
35500  */
35501  (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);
35502 
35503  /* "View.MemoryView":885
35504  *
35505  * dst.strides[new_ndim] = stride * step
35506  * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<<
35507  * dst.suboffsets[new_ndim] = suboffset
35508  *
35509  */
35510  (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;
35511 
35512  /* "View.MemoryView":886
35513  * dst.strides[new_ndim] = stride * step
35514  * dst.shape[new_ndim] = new_shape
35515  * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<<
35516  *
35517  *
35518  */
35519  (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
35520  }
35521  __pyx_L3:;
35522 
35523  /* "View.MemoryView":889
35524  *
35525  *
35526  * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<<
35527  * dst.data += start * stride
35528  * else:
35529  */
35530  __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
35531  if (__pyx_t_2) {
35532 
35533  /* "View.MemoryView":890
35534  *
35535  * if suboffset_dim[0] < 0:
35536  * dst.data += start * stride # <<<<<<<<<<<<<<
35537  * else:
35538  * dst.suboffsets[suboffset_dim[0]] += start * stride
35539  */
35540  __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));
35541 
35542  /* "View.MemoryView":889
35543  *
35544  *
35545  * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<<
35546  * dst.data += start * stride
35547  * else:
35548  */
35549  goto __pyx_L23;
35550  }
35551 
35552  /* "View.MemoryView":892
35553  * dst.data += start * stride
35554  * else:
35555  * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<<
35556  *
35557  * if suboffset >= 0:
35558  */
35559  /*else*/ {
35560  __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
35561  (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
35562  }
35563  __pyx_L23:;
35564 
35565  /* "View.MemoryView":894
35566  * dst.suboffsets[suboffset_dim[0]] += start * stride
35567  *
35568  * if suboffset >= 0: # <<<<<<<<<<<<<<
35569  * if not is_slice:
35570  * if new_ndim == 0:
35571  */
35572  __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
35573  if (__pyx_t_2) {
35574 
35575  /* "View.MemoryView":895
35576  *
35577  * if suboffset >= 0:
35578  * if not is_slice: # <<<<<<<<<<<<<<
35579  * if new_ndim == 0:
35580  * dst.data = (<char **> dst.data)[0] + suboffset
35581  */
35582  __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
35583  if (__pyx_t_2) {
35584 
35585  /* "View.MemoryView":896
35586  * if suboffset >= 0:
35587  * if not is_slice:
35588  * if new_ndim == 0: # <<<<<<<<<<<<<<
35589  * dst.data = (<char **> dst.data)[0] + suboffset
35590  * else:
35591  */
35592  __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
35593  if (__pyx_t_2) {
35594 
35595  /* "View.MemoryView":897
35596  * if not is_slice:
35597  * if new_ndim == 0:
35598  * dst.data = (<char **> dst.data)[0] + suboffset # <<<<<<<<<<<<<<
35599  * else:
35600  * _err_dim(IndexError, "All dimensions preceding dimension %d "
35601  */
35602  __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);
35603 
35604  /* "View.MemoryView":896
35605  * if suboffset >= 0:
35606  * if not is_slice:
35607  * if new_ndim == 0: # <<<<<<<<<<<<<<
35608  * dst.data = (<char **> dst.data)[0] + suboffset
35609  * else:
35610  */
35611  goto __pyx_L26;
35612  }
35613 
35614  /* "View.MemoryView":899
35615  * dst.data = (<char **> dst.data)[0] + suboffset
35616  * else:
35617  * _err_dim(IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<<
35618  * "must be indexed and not sliced", dim)
35619  * else:
35620  */
35621  /*else*/ {
35622 
35623  /* "View.MemoryView":900
35624  * else:
35625  * _err_dim(IndexError, "All dimensions preceding dimension %d "
35626  * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<<
35627  * else:
35628  * suboffset_dim[0] = new_ndim
35629  */
35630  __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 899, __pyx_L1_error)
35631  }
35632  __pyx_L26:;
35633 
35634  /* "View.MemoryView":895
35635  *
35636  * if suboffset >= 0:
35637  * if not is_slice: # <<<<<<<<<<<<<<
35638  * if new_ndim == 0:
35639  * dst.data = (<char **> dst.data)[0] + suboffset
35640  */
35641  goto __pyx_L25;
35642  }
35643 
35644  /* "View.MemoryView":902
35645  * "must be indexed and not sliced", dim)
35646  * else:
35647  * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<<
35648  *
35649  * return 0
35650  */
35651  /*else*/ {
35652  (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
35653  }
35654  __pyx_L25:;
35655 
35656  /* "View.MemoryView":894
35657  * dst.suboffsets[suboffset_dim[0]] += start * stride
35658  *
35659  * if suboffset >= 0: # <<<<<<<<<<<<<<
35660  * if not is_slice:
35661  * if new_ndim == 0:
35662  */
35663  }
35664 
35665  /* "View.MemoryView":904
35666  * suboffset_dim[0] = new_ndim
35667  *
35668  * return 0 # <<<<<<<<<<<<<<
35669  *
35670  *
35671  */
35672  __pyx_r = 0;
35673  goto __pyx_L0;
35674 
35675  /* "View.MemoryView":807
35676  *
35677  * @cname('__pyx_memoryview_slice_memviewslice')
35678  * cdef int slice_memviewslice( # <<<<<<<<<<<<<<
35679  * __Pyx_memviewslice *dst,
35680  * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
35681  */
35682 
35683  /* function exit code */
35684  __pyx_L1_error:;
35685  {
35686  #ifdef WITH_THREAD
35687  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
35688  #endif
35689  __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
35690  #ifdef WITH_THREAD
35691  __Pyx_PyGILState_Release(__pyx_gilstate_save);
35692  #endif
35693  }
35694  __pyx_r = -1;
35695  __pyx_L0:;
35696  return __pyx_r;
35697 }
35698 
35699 /* "View.MemoryView":910
35700  *
35701  * @cname('__pyx_pybuffer_index')
35702  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<<
35703  * Py_ssize_t dim) except NULL:
35704  * cdef Py_ssize_t shape, stride, suboffset = -1
35705  */
35706 
35707 static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) {
35708  Py_ssize_t __pyx_v_shape;
35709  Py_ssize_t __pyx_v_stride;
35710  Py_ssize_t __pyx_v_suboffset;
35711  Py_ssize_t __pyx_v_itemsize;
35712  char *__pyx_v_resultp;
35713  char *__pyx_r;
35714  __Pyx_RefNannyDeclarations
35715  Py_ssize_t __pyx_t_1;
35716  int __pyx_t_2;
35717  PyObject *__pyx_t_3 = NULL;
35718  PyObject *__pyx_t_4 = NULL;
35719  __Pyx_RefNannySetupContext("pybuffer_index", 0);
35720 
35721  /* "View.MemoryView":912
35722  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
35723  * Py_ssize_t dim) except NULL:
35724  * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<<
35725  * cdef Py_ssize_t itemsize = view.itemsize
35726  * cdef char *resultp
35727  */
35728  __pyx_v_suboffset = -1L;
35729 
35730  /* "View.MemoryView":913
35731  * Py_ssize_t dim) except NULL:
35732  * cdef Py_ssize_t shape, stride, suboffset = -1
35733  * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<<
35734  * cdef char *resultp
35735  *
35736  */
35737  __pyx_t_1 = __pyx_v_view->itemsize;
35738  __pyx_v_itemsize = __pyx_t_1;
35739 
35740  /* "View.MemoryView":916
35741  * cdef char *resultp
35742  *
35743  * if view.ndim == 0: # <<<<<<<<<<<<<<
35744  * shape = view.len / itemsize
35745  * stride = itemsize
35746  */
35747  __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
35748  if (__pyx_t_2) {
35749 
35750  /* "View.MemoryView":917
35751  *
35752  * if view.ndim == 0:
35753  * shape = view.len / itemsize # <<<<<<<<<<<<<<
35754  * stride = itemsize
35755  * else:
35756  */
35757  if (unlikely(__pyx_v_itemsize == 0)) {
35758  PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
35759  __PYX_ERR(2, 917, __pyx_L1_error)
35760  }
35761  else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) {
35762  PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
35763  __PYX_ERR(2, 917, __pyx_L1_error)
35764  }
35765  __pyx_v_shape = (__pyx_v_view->len / __pyx_v_itemsize);
35766 
35767  /* "View.MemoryView":918
35768  * if view.ndim == 0:
35769  * shape = view.len / itemsize
35770  * stride = itemsize # <<<<<<<<<<<<<<
35771  * else:
35772  * shape = view.shape[dim]
35773  */
35774  __pyx_v_stride = __pyx_v_itemsize;
35775 
35776  /* "View.MemoryView":916
35777  * cdef char *resultp
35778  *
35779  * if view.ndim == 0: # <<<<<<<<<<<<<<
35780  * shape = view.len / itemsize
35781  * stride = itemsize
35782  */
35783  goto __pyx_L3;
35784  }
35785 
35786  /* "View.MemoryView":920
35787  * stride = itemsize
35788  * else:
35789  * shape = view.shape[dim] # <<<<<<<<<<<<<<
35790  * stride = view.strides[dim]
35791  * if view.suboffsets != NULL:
35792  */
35793  /*else*/ {
35794  __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);
35795 
35796  /* "View.MemoryView":921
35797  * else:
35798  * shape = view.shape[dim]
35799  * stride = view.strides[dim] # <<<<<<<<<<<<<<
35800  * if view.suboffsets != NULL:
35801  * suboffset = view.suboffsets[dim]
35802  */
35803  __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);
35804 
35805  /* "View.MemoryView":922
35806  * shape = view.shape[dim]
35807  * stride = view.strides[dim]
35808  * if view.suboffsets != NULL: # <<<<<<<<<<<<<<
35809  * suboffset = view.suboffsets[dim]
35810  *
35811  */
35812  __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
35813  if (__pyx_t_2) {
35814 
35815  /* "View.MemoryView":923
35816  * stride = view.strides[dim]
35817  * if view.suboffsets != NULL:
35818  * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<<
35819  *
35820  * if index < 0:
35821  */
35822  __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);
35823 
35824  /* "View.MemoryView":922
35825  * shape = view.shape[dim]
35826  * stride = view.strides[dim]
35827  * if view.suboffsets != NULL: # <<<<<<<<<<<<<<
35828  * suboffset = view.suboffsets[dim]
35829  *
35830  */
35831  }
35832  }
35833  __pyx_L3:;
35834 
35835  /* "View.MemoryView":925
35836  * suboffset = view.suboffsets[dim]
35837  *
35838  * if index < 0: # <<<<<<<<<<<<<<
35839  * index += view.shape[dim]
35840  * if index < 0:
35841  */
35842  __pyx_t_2 = ((__pyx_v_index < 0) != 0);
35843  if (__pyx_t_2) {
35844 
35845  /* "View.MemoryView":926
35846  *
35847  * if index < 0:
35848  * index += view.shape[dim] # <<<<<<<<<<<<<<
35849  * if index < 0:
35850  * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
35851  */
35852  __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));
35853 
35854  /* "View.MemoryView":927
35855  * if index < 0:
35856  * index += view.shape[dim]
35857  * if index < 0: # <<<<<<<<<<<<<<
35858  * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
35859  *
35860  */
35861  __pyx_t_2 = ((__pyx_v_index < 0) != 0);
35862  if (unlikely(__pyx_t_2)) {
35863 
35864  /* "View.MemoryView":928
35865  * index += view.shape[dim]
35866  * if index < 0:
35867  * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<<
35868  *
35869  * if index >= shape:
35870  */
35871  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 928, __pyx_L1_error)
35872  __Pyx_GOTREF(__pyx_t_3);
35873  __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 928, __pyx_L1_error)
35874  __Pyx_GOTREF(__pyx_t_4);
35875  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
35876  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 928, __pyx_L1_error)
35877  __Pyx_GOTREF(__pyx_t_3);
35878  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
35879  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
35880  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
35881  __PYX_ERR(2, 928, __pyx_L1_error)
35882 
35883  /* "View.MemoryView":927
35884  * if index < 0:
35885  * index += view.shape[dim]
35886  * if index < 0: # <<<<<<<<<<<<<<
35887  * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
35888  *
35889  */
35890  }
35891 
35892  /* "View.MemoryView":925
35893  * suboffset = view.suboffsets[dim]
35894  *
35895  * if index < 0: # <<<<<<<<<<<<<<
35896  * index += view.shape[dim]
35897  * if index < 0:
35898  */
35899  }
35900 
35901  /* "View.MemoryView":930
35902  * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
35903  *
35904  * if index >= shape: # <<<<<<<<<<<<<<
35905  * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
35906  *
35907  */
35908  __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
35909  if (unlikely(__pyx_t_2)) {
35910 
35911  /* "View.MemoryView":931
35912  *
35913  * if index >= shape:
35914  * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<<
35915  *
35916  * resultp = bufp + index * stride
35917  */
35918  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 931, __pyx_L1_error)
35919  __Pyx_GOTREF(__pyx_t_3);
35920  __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 931, __pyx_L1_error)
35921  __Pyx_GOTREF(__pyx_t_4);
35922  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
35923  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 931, __pyx_L1_error)
35924  __Pyx_GOTREF(__pyx_t_3);
35925  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
35926  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
35927  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
35928  __PYX_ERR(2, 931, __pyx_L1_error)
35929 
35930  /* "View.MemoryView":930
35931  * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
35932  *
35933  * if index >= shape: # <<<<<<<<<<<<<<
35934  * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
35935  *
35936  */
35937  }
35938 
35939  /* "View.MemoryView":933
35940  * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
35941  *
35942  * resultp = bufp + index * stride # <<<<<<<<<<<<<<
35943  * if suboffset >= 0:
35944  * resultp = (<char **> resultp)[0] + suboffset
35945  */
35946  __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));
35947 
35948  /* "View.MemoryView":934
35949  *
35950  * resultp = bufp + index * stride
35951  * if suboffset >= 0: # <<<<<<<<<<<<<<
35952  * resultp = (<char **> resultp)[0] + suboffset
35953  *
35954  */
35955  __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
35956  if (__pyx_t_2) {
35957 
35958  /* "View.MemoryView":935
35959  * resultp = bufp + index * stride
35960  * if suboffset >= 0:
35961  * resultp = (<char **> resultp)[0] + suboffset # <<<<<<<<<<<<<<
35962  *
35963  * return resultp
35964  */
35965  __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);
35966 
35967  /* "View.MemoryView":934
35968  *
35969  * resultp = bufp + index * stride
35970  * if suboffset >= 0: # <<<<<<<<<<<<<<
35971  * resultp = (<char **> resultp)[0] + suboffset
35972  *
35973  */
35974  }
35975 
35976  /* "View.MemoryView":937
35977  * resultp = (<char **> resultp)[0] + suboffset
35978  *
35979  * return resultp # <<<<<<<<<<<<<<
35980  *
35981  *
35982  */
35983  __pyx_r = __pyx_v_resultp;
35984  goto __pyx_L0;
35985 
35986  /* "View.MemoryView":910
35987  *
35988  * @cname('__pyx_pybuffer_index')
35989  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<<
35990  * Py_ssize_t dim) except NULL:
35991  * cdef Py_ssize_t shape, stride, suboffset = -1
35992  */
35993 
35994  /* function exit code */
35995  __pyx_L1_error:;
35996  __Pyx_XDECREF(__pyx_t_3);
35997  __Pyx_XDECREF(__pyx_t_4);
35998  __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
35999  __pyx_r = NULL;
36000  __pyx_L0:;
36001  __Pyx_RefNannyFinishContext();
36002  return __pyx_r;
36003 }
36004 
36005 /* "View.MemoryView":943
36006  *
36007  * @cname('__pyx_memslice_transpose')
36008  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<<
36009  * cdef int ndim = memslice.memview.view.ndim
36010  *
36011  */
36012 
36013 static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
36014  int __pyx_v_ndim;
36015  Py_ssize_t *__pyx_v_shape;
36016  Py_ssize_t *__pyx_v_strides;
36017  int __pyx_v_i;
36018  int __pyx_v_j;
36019  int __pyx_r;
36020  int __pyx_t_1;
36021  Py_ssize_t *__pyx_t_2;
36022  long __pyx_t_3;
36023  long __pyx_t_4;
36024  Py_ssize_t __pyx_t_5;
36025  Py_ssize_t __pyx_t_6;
36026  int __pyx_t_7;
36027  int __pyx_t_8;
36028  int __pyx_t_9;
36029 
36030  /* "View.MemoryView":944
36031  * @cname('__pyx_memslice_transpose')
36032  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:
36033  * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<<
36034  *
36035  * cdef Py_ssize_t *shape = memslice.shape
36036  */
36037  __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
36038  __pyx_v_ndim = __pyx_t_1;
36039 
36040  /* "View.MemoryView":946
36041  * cdef int ndim = memslice.memview.view.ndim
36042  *
36043  * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<<
36044  * cdef Py_ssize_t *strides = memslice.strides
36045  *
36046  */
36047  __pyx_t_2 = __pyx_v_memslice->shape;
36048  __pyx_v_shape = __pyx_t_2;
36049 
36050  /* "View.MemoryView":947
36051  *
36052  * cdef Py_ssize_t *shape = memslice.shape
36053  * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<<
36054  *
36055  *
36056  */
36057  __pyx_t_2 = __pyx_v_memslice->strides;
36058  __pyx_v_strides = __pyx_t_2;
36059 
36060  /* "View.MemoryView":951
36061  *
36062  * cdef int i, j
36063  * for i in range(ndim / 2): # <<<<<<<<<<<<<<
36064  * j = ndim - 1 - i
36065  * strides[i], strides[j] = strides[j], strides[i]
36066  */
36067  __pyx_t_3 = (__pyx_v_ndim / 2);
36068  __pyx_t_4 = __pyx_t_3;
36069  for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) {
36070  __pyx_v_i = __pyx_t_1;
36071 
36072  /* "View.MemoryView":952
36073  * cdef int i, j
36074  * for i in range(ndim / 2):
36075  * j = ndim - 1 - i # <<<<<<<<<<<<<<
36076  * strides[i], strides[j] = strides[j], strides[i]
36077  * shape[i], shape[j] = shape[j], shape[i]
36078  */
36079  __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);
36080 
36081  /* "View.MemoryView":953
36082  * for i in range(ndim / 2):
36083  * j = ndim - 1 - i
36084  * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<<
36085  * shape[i], shape[j] = shape[j], shape[i]
36086  *
36087  */
36088  __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]);
36089  __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]);
36090  (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5;
36091  (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6;
36092 
36093  /* "View.MemoryView":954
36094  * j = ndim - 1 - i
36095  * strides[i], strides[j] = strides[j], strides[i]
36096  * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<<
36097  *
36098  * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
36099  */
36100  __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]);
36101  __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]);
36102  (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6;
36103  (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5;
36104 
36105  /* "View.MemoryView":956
36106  * shape[i], shape[j] = shape[j], shape[i]
36107  *
36108  * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<<
36109  * _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
36110  *
36111  */
36112  __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
36113  if (!__pyx_t_8) {
36114  } else {
36115  __pyx_t_7 = __pyx_t_8;
36116  goto __pyx_L6_bool_binop_done;
36117  }
36118  __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
36119  __pyx_t_7 = __pyx_t_8;
36120  __pyx_L6_bool_binop_done:;
36121  if (__pyx_t_7) {
36122 
36123  /* "View.MemoryView":957
36124  *
36125  * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
36126  * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<<
36127  *
36128  * return 1
36129  */
36130  __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((char *)"Cannot transpose memoryview with indirect dimensions")); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 957, __pyx_L1_error)
36131 
36132  /* "View.MemoryView":956
36133  * shape[i], shape[j] = shape[j], shape[i]
36134  *
36135  * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<<
36136  * _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
36137  *
36138  */
36139  }
36140  }
36141 
36142  /* "View.MemoryView":959
36143  * _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
36144  *
36145  * return 1 # <<<<<<<<<<<<<<
36146  *
36147  *
36148  */
36149  __pyx_r = 1;
36150  goto __pyx_L0;
36151 
36152  /* "View.MemoryView":943
36153  *
36154  * @cname('__pyx_memslice_transpose')
36155  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<<
36156  * cdef int ndim = memslice.memview.view.ndim
36157  *
36158  */
36159 
36160  /* function exit code */
36161  __pyx_L1_error:;
36162  {
36163  #ifdef WITH_THREAD
36164  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
36165  #endif
36166  __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
36167  #ifdef WITH_THREAD
36168  __Pyx_PyGILState_Release(__pyx_gilstate_save);
36169  #endif
36170  }
36171  __pyx_r = 0;
36172  __pyx_L0:;
36173  return __pyx_r;
36174 }
36175 
36176 /* "View.MemoryView":976
36177  * cdef int (*to_dtype_func)(char *, object) except 0
36178  *
36179  * def __dealloc__(self): # <<<<<<<<<<<<<<
36180  * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
36181  *
36182  */
36183 
36184 /* Python wrapper */
36185 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/
36186 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
36187  __Pyx_RefNannyDeclarations
36188  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
36189  __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
36190 
36191  /* function exit code */
36192  __Pyx_RefNannyFinishContext();
36193 }
36194 
36195 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
36196  __Pyx_RefNannyDeclarations
36197  __Pyx_RefNannySetupContext("__dealloc__", 0);
36198 
36199  /* "View.MemoryView":977
36200  *
36201  * def __dealloc__(self):
36202  * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<<
36203  *
36204  * cdef convert_item_to_object(self, char *itemp):
36205  */
36206  __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);
36207 
36208  /* "View.MemoryView":976
36209  * cdef int (*to_dtype_func)(char *, object) except 0
36210  *
36211  * def __dealloc__(self): # <<<<<<<<<<<<<<
36212  * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
36213  *
36214  */
36215 
36216  /* function exit code */
36217  __Pyx_RefNannyFinishContext();
36218 }
36219 
36220 /* "View.MemoryView":979
36221  * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
36222  *
36223  * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
36224  * if self.to_object_func != NULL:
36225  * return self.to_object_func(itemp)
36226  */
36227 
36228 static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) {
36229  PyObject *__pyx_r = NULL;
36230  __Pyx_RefNannyDeclarations
36231  int __pyx_t_1;
36232  PyObject *__pyx_t_2 = NULL;
36233  __Pyx_RefNannySetupContext("convert_item_to_object", 0);
36234 
36235  /* "View.MemoryView":980
36236  *
36237  * cdef convert_item_to_object(self, char *itemp):
36238  * if self.to_object_func != NULL: # <<<<<<<<<<<<<<
36239  * return self.to_object_func(itemp)
36240  * else:
36241  */
36242  __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
36243  if (__pyx_t_1) {
36244 
36245  /* "View.MemoryView":981
36246  * cdef convert_item_to_object(self, char *itemp):
36247  * if self.to_object_func != NULL:
36248  * return self.to_object_func(itemp) # <<<<<<<<<<<<<<
36249  * else:
36250  * return memoryview.convert_item_to_object(self, itemp)
36251  */
36252  __Pyx_XDECREF(__pyx_r);
36253  __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 981, __pyx_L1_error)
36254  __Pyx_GOTREF(__pyx_t_2);
36255  __pyx_r = __pyx_t_2;
36256  __pyx_t_2 = 0;
36257  goto __pyx_L0;
36258 
36259  /* "View.MemoryView":980
36260  *
36261  * cdef convert_item_to_object(self, char *itemp):
36262  * if self.to_object_func != NULL: # <<<<<<<<<<<<<<
36263  * return self.to_object_func(itemp)
36264  * else:
36265  */
36266  }
36267 
36268  /* "View.MemoryView":983
36269  * return self.to_object_func(itemp)
36270  * else:
36271  * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<<
36272  *
36273  * cdef assign_item_from_object(self, char *itemp, object value):
36274  */
36275  /*else*/ {
36276  __Pyx_XDECREF(__pyx_r);
36277  __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 983, __pyx_L1_error)
36278  __Pyx_GOTREF(__pyx_t_2);
36279  __pyx_r = __pyx_t_2;
36280  __pyx_t_2 = 0;
36281  goto __pyx_L0;
36282  }
36283 
36284  /* "View.MemoryView":979
36285  * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
36286  *
36287  * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
36288  * if self.to_object_func != NULL:
36289  * return self.to_object_func(itemp)
36290  */
36291 
36292  /* function exit code */
36293  __pyx_L1_error:;
36294  __Pyx_XDECREF(__pyx_t_2);
36295  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
36296  __pyx_r = 0;
36297  __pyx_L0:;
36298  __Pyx_XGIVEREF(__pyx_r);
36299  __Pyx_RefNannyFinishContext();
36300  return __pyx_r;
36301 }
36302 
36303 /* "View.MemoryView":985
36304  * return memoryview.convert_item_to_object(self, itemp)
36305  *
36306  * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
36307  * if self.to_dtype_func != NULL:
36308  * self.to_dtype_func(itemp, value)
36309  */
36310 
36311 static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
36312  PyObject *__pyx_r = NULL;
36313  __Pyx_RefNannyDeclarations
36314  int __pyx_t_1;
36315  int __pyx_t_2;
36316  PyObject *__pyx_t_3 = NULL;
36317  __Pyx_RefNannySetupContext("assign_item_from_object", 0);
36318 
36319  /* "View.MemoryView":986
36320  *
36321  * cdef assign_item_from_object(self, char *itemp, object value):
36322  * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<<
36323  * self.to_dtype_func(itemp, value)
36324  * else:
36325  */
36326  __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
36327  if (__pyx_t_1) {
36328 
36329  /* "View.MemoryView":987
36330  * cdef assign_item_from_object(self, char *itemp, object value):
36331  * if self.to_dtype_func != NULL:
36332  * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<<
36333  * else:
36334  * memoryview.assign_item_from_object(self, itemp, value)
36335  */
36336  __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 987, __pyx_L1_error)
36337 
36338  /* "View.MemoryView":986
36339  *
36340  * cdef assign_item_from_object(self, char *itemp, object value):
36341  * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<<
36342  * self.to_dtype_func(itemp, value)
36343  * else:
36344  */
36345  goto __pyx_L3;
36346  }
36347 
36348  /* "View.MemoryView":989
36349  * self.to_dtype_func(itemp, value)
36350  * else:
36351  * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<<
36352  *
36353  * @property
36354  */
36355  /*else*/ {
36356  __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 989, __pyx_L1_error)
36357  __Pyx_GOTREF(__pyx_t_3);
36358  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
36359  }
36360  __pyx_L3:;
36361 
36362  /* "View.MemoryView":985
36363  * return memoryview.convert_item_to_object(self, itemp)
36364  *
36365  * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
36366  * if self.to_dtype_func != NULL:
36367  * self.to_dtype_func(itemp, value)
36368  */
36369 
36370  /* function exit code */
36371  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
36372  goto __pyx_L0;
36373  __pyx_L1_error:;
36374  __Pyx_XDECREF(__pyx_t_3);
36375  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
36376  __pyx_r = 0;
36377  __pyx_L0:;
36378  __Pyx_XGIVEREF(__pyx_r);
36379  __Pyx_RefNannyFinishContext();
36380  return __pyx_r;
36381 }
36382 
36383 /* "View.MemoryView":992
36384  *
36385  * @property
36386  * def base(self): # <<<<<<<<<<<<<<
36387  * return self.from_object
36388  *
36389  */
36390 
36391 /* Python wrapper */
36392 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
36393 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) {
36394  PyObject *__pyx_r = 0;
36395  __Pyx_RefNannyDeclarations
36396  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
36397  __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
36398 
36399  /* function exit code */
36400  __Pyx_RefNannyFinishContext();
36401  return __pyx_r;
36402 }
36403 
36404 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
36405  PyObject *__pyx_r = NULL;
36406  __Pyx_RefNannyDeclarations
36407  __Pyx_RefNannySetupContext("__get__", 0);
36408 
36409  /* "View.MemoryView":993
36410  * @property
36411  * def base(self):
36412  * return self.from_object # <<<<<<<<<<<<<<
36413  *
36414  * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
36415  */
36416  __Pyx_XDECREF(__pyx_r);
36417  __Pyx_INCREF(__pyx_v_self->from_object);
36418  __pyx_r = __pyx_v_self->from_object;
36419  goto __pyx_L0;
36420 
36421  /* "View.MemoryView":992
36422  *
36423  * @property
36424  * def base(self): # <<<<<<<<<<<<<<
36425  * return self.from_object
36426  *
36427  */
36428 
36429  /* function exit code */
36430  __pyx_L0:;
36431  __Pyx_XGIVEREF(__pyx_r);
36432  __Pyx_RefNannyFinishContext();
36433  return __pyx_r;
36434 }
36435 
36436 /* "(tree fragment)":1
36437  * def __reduce_cython__(self): # <<<<<<<<<<<<<<
36438  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
36439  * def __setstate_cython__(self, __pyx_state):
36440  */
36441 
36442 /* Python wrapper */
36443 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
36444 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
36445  PyObject *__pyx_r = 0;
36446  __Pyx_RefNannyDeclarations
36447  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
36448  __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
36449 
36450  /* function exit code */
36451  __Pyx_RefNannyFinishContext();
36452  return __pyx_r;
36453 }
36454 
36455 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) {
36456  PyObject *__pyx_r = NULL;
36457  __Pyx_RefNannyDeclarations
36458  PyObject *__pyx_t_1 = NULL;
36459  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
36460 
36461  /* "(tree fragment)":2
36462  * def __reduce_cython__(self):
36463  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
36464  * def __setstate_cython__(self, __pyx_state):
36465  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
36466  */
36467  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
36468  __Pyx_GOTREF(__pyx_t_1);
36469  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
36470  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
36471  __PYX_ERR(2, 2, __pyx_L1_error)
36472 
36473  /* "(tree fragment)":1
36474  * def __reduce_cython__(self): # <<<<<<<<<<<<<<
36475  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
36476  * def __setstate_cython__(self, __pyx_state):
36477  */
36478 
36479  /* function exit code */
36480  __pyx_L1_error:;
36481  __Pyx_XDECREF(__pyx_t_1);
36482  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
36483  __pyx_r = NULL;
36484  __Pyx_XGIVEREF(__pyx_r);
36485  __Pyx_RefNannyFinishContext();
36486  return __pyx_r;
36487 }
36488 
36489 /* "(tree fragment)":3
36490  * def __reduce_cython__(self):
36491  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
36492  * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
36493  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
36494  */
36495 
36496 /* Python wrapper */
36497 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
36498 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
36499  PyObject *__pyx_r = 0;
36500  __Pyx_RefNannyDeclarations
36501  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
36502  __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
36503 
36504  /* function exit code */
36505  __Pyx_RefNannyFinishContext();
36506  return __pyx_r;
36507 }
36508 
36509 static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
36510  PyObject *__pyx_r = NULL;
36511  __Pyx_RefNannyDeclarations
36512  PyObject *__pyx_t_1 = NULL;
36513  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
36514 
36515  /* "(tree fragment)":4
36516  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
36517  * def __setstate_cython__(self, __pyx_state):
36518  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
36519  */
36520  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
36521  __Pyx_GOTREF(__pyx_t_1);
36522  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
36523  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
36524  __PYX_ERR(2, 4, __pyx_L1_error)
36525 
36526  /* "(tree fragment)":3
36527  * def __reduce_cython__(self):
36528  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
36529  * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
36530  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
36531  */
36532 
36533  /* function exit code */
36534  __pyx_L1_error:;
36535  __Pyx_XDECREF(__pyx_t_1);
36536  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
36537  __pyx_r = NULL;
36538  __Pyx_XGIVEREF(__pyx_r);
36539  __Pyx_RefNannyFinishContext();
36540  return __pyx_r;
36541 }
36542 
36543 /* "View.MemoryView":999
36544  *
36545  * @cname('__pyx_memoryview_fromslice')
36546  * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<<
36547  * int ndim,
36548  * object (*to_object_func)(char *),
36549  */
36550 
36551 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) {
36552  struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
36553  Py_ssize_t __pyx_v_suboffset;
36554  PyObject *__pyx_v_length = NULL;
36555  PyObject *__pyx_r = NULL;
36556  __Pyx_RefNannyDeclarations
36557  int __pyx_t_1;
36558  PyObject *__pyx_t_2 = NULL;
36559  PyObject *__pyx_t_3 = NULL;
36560  __Pyx_TypeInfo *__pyx_t_4;
36561  Py_buffer __pyx_t_5;
36562  Py_ssize_t *__pyx_t_6;
36563  Py_ssize_t *__pyx_t_7;
36564  Py_ssize_t *__pyx_t_8;
36565  Py_ssize_t __pyx_t_9;
36566  __Pyx_RefNannySetupContext("memoryview_fromslice", 0);
36567 
36568  /* "View.MemoryView":1007
36569  * cdef _memoryviewslice result
36570  *
36571  * if <PyObject *> memviewslice.memview == Py_None: # <<<<<<<<<<<<<<
36572  * return None
36573  *
36574  */
36575  __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
36576  if (__pyx_t_1) {
36577 
36578  /* "View.MemoryView":1008
36579  *
36580  * if <PyObject *> memviewslice.memview == Py_None:
36581  * return None # <<<<<<<<<<<<<<
36582  *
36583  *
36584  */
36585  __Pyx_XDECREF(__pyx_r);
36586  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
36587  goto __pyx_L0;
36588 
36589  /* "View.MemoryView":1007
36590  * cdef _memoryviewslice result
36591  *
36592  * if <PyObject *> memviewslice.memview == Py_None: # <<<<<<<<<<<<<<
36593  * return None
36594  *
36595  */
36596  }
36597 
36598  /* "View.MemoryView":1013
36599  *
36600  *
36601  * result = _memoryviewslice(None, 0, dtype_is_object) # <<<<<<<<<<<<<<
36602  *
36603  * result.from_slice = memviewslice
36604  */
36605  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1013, __pyx_L1_error)
36606  __Pyx_GOTREF(__pyx_t_2);
36607  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1013, __pyx_L1_error)
36608  __Pyx_GOTREF(__pyx_t_3);
36609  __Pyx_INCREF(Py_None);
36610  __Pyx_GIVEREF(Py_None);
36611  PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
36612  __Pyx_INCREF(__pyx_int_0);
36613  __Pyx_GIVEREF(__pyx_int_0);
36614  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
36615  __Pyx_GIVEREF(__pyx_t_2);
36616  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
36617  __pyx_t_2 = 0;
36618  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1013, __pyx_L1_error)
36619  __Pyx_GOTREF(__pyx_t_2);
36620  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
36621  __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
36622  __pyx_t_2 = 0;
36623 
36624  /* "View.MemoryView":1015
36625  * result = _memoryviewslice(None, 0, dtype_is_object)
36626  *
36627  * result.from_slice = memviewslice # <<<<<<<<<<<<<<
36628  * __PYX_INC_MEMVIEW(&memviewslice, 1)
36629  *
36630  */
36631  __pyx_v_result->from_slice = __pyx_v_memviewslice;
36632 
36633  /* "View.MemoryView":1016
36634  *
36635  * result.from_slice = memviewslice
36636  * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<<
36637  *
36638  * result.from_object = (<memoryview> memviewslice.memview).base
36639  */
36640  __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);
36641 
36642  /* "View.MemoryView":1018
36643  * __PYX_INC_MEMVIEW(&memviewslice, 1)
36644  *
36645  * result.from_object = (<memoryview> memviewslice.memview).base # <<<<<<<<<<<<<<
36646  * result.typeinfo = memviewslice.memview.typeinfo
36647  *
36648  */
36649  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1018, __pyx_L1_error)
36650  __Pyx_GOTREF(__pyx_t_2);
36651  __Pyx_GIVEREF(__pyx_t_2);
36652  __Pyx_GOTREF(__pyx_v_result->from_object);
36653  __Pyx_DECREF(__pyx_v_result->from_object);
36654  __pyx_v_result->from_object = __pyx_t_2;
36655  __pyx_t_2 = 0;
36656 
36657  /* "View.MemoryView":1019
36658  *
36659  * result.from_object = (<memoryview> memviewslice.memview).base
36660  * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<<
36661  *
36662  * result.view = memviewslice.memview.view
36663  */
36664  __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
36665  __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
36666 
36667  /* "View.MemoryView":1021
36668  * result.typeinfo = memviewslice.memview.typeinfo
36669  *
36670  * result.view = memviewslice.memview.view # <<<<<<<<<<<<<<
36671  * result.view.buf = <void *> memviewslice.data
36672  * result.view.ndim = ndim
36673  */
36674  __pyx_t_5 = __pyx_v_memviewslice.memview->view;
36675  __pyx_v_result->__pyx_base.view = __pyx_t_5;
36676 
36677  /* "View.MemoryView":1022
36678  *
36679  * result.view = memviewslice.memview.view
36680  * result.view.buf = <void *> memviewslice.data # <<<<<<<<<<<<<<
36681  * result.view.ndim = ndim
36682  * (<__pyx_buffer *> &result.view).obj = Py_None
36683  */
36684  __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data);
36685 
36686  /* "View.MemoryView":1023
36687  * result.view = memviewslice.memview.view
36688  * result.view.buf = <void *> memviewslice.data
36689  * result.view.ndim = ndim # <<<<<<<<<<<<<<
36690  * (<__pyx_buffer *> &result.view).obj = Py_None
36691  * Py_INCREF(Py_None)
36692  */
36693  __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;
36694 
36695  /* "View.MemoryView":1024
36696  * result.view.buf = <void *> memviewslice.data
36697  * result.view.ndim = ndim
36698  * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<<
36699  * Py_INCREF(Py_None)
36700  *
36701  */
36702  ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;
36703 
36704  /* "View.MemoryView":1025
36705  * result.view.ndim = ndim
36706  * (<__pyx_buffer *> &result.view).obj = Py_None
36707  * Py_INCREF(Py_None) # <<<<<<<<<<<<<<
36708  *
36709  * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
36710  */
36711  Py_INCREF(Py_None);
36712 
36713  /* "View.MemoryView":1027
36714  * Py_INCREF(Py_None)
36715  *
36716  * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<<
36717  * result.flags = PyBUF_RECORDS
36718  * else:
36719  */
36720  __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
36721  if (__pyx_t_1) {
36722 
36723  /* "View.MemoryView":1028
36724  *
36725  * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
36726  * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<<
36727  * else:
36728  * result.flags = PyBUF_RECORDS_RO
36729  */
36730  __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;
36731 
36732  /* "View.MemoryView":1027
36733  * Py_INCREF(Py_None)
36734  *
36735  * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<<
36736  * result.flags = PyBUF_RECORDS
36737  * else:
36738  */
36739  goto __pyx_L4;
36740  }
36741 
36742  /* "View.MemoryView":1030
36743  * result.flags = PyBUF_RECORDS
36744  * else:
36745  * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<<
36746  *
36747  * result.view.shape = <Py_ssize_t *> result.from_slice.shape
36748  */
36749  /*else*/ {
36750  __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
36751  }
36752  __pyx_L4:;
36753 
36754  /* "View.MemoryView":1032
36755  * result.flags = PyBUF_RECORDS_RO
36756  *
36757  * result.view.shape = <Py_ssize_t *> result.from_slice.shape # <<<<<<<<<<<<<<
36758  * result.view.strides = <Py_ssize_t *> result.from_slice.strides
36759  *
36760  */
36761  __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);
36762 
36763  /* "View.MemoryView":1033
36764  *
36765  * result.view.shape = <Py_ssize_t *> result.from_slice.shape
36766  * result.view.strides = <Py_ssize_t *> result.from_slice.strides # <<<<<<<<<<<<<<
36767  *
36768  *
36769  */
36770  __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);
36771 
36772  /* "View.MemoryView":1036
36773  *
36774  *
36775  * result.view.suboffsets = NULL # <<<<<<<<<<<<<<
36776  * for suboffset in result.from_slice.suboffsets[:ndim]:
36777  * if suboffset >= 0:
36778  */
36779  __pyx_v_result->__pyx_base.view.suboffsets = NULL;
36780 
36781  /* "View.MemoryView":1037
36782  *
36783  * result.view.suboffsets = NULL
36784  * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<<
36785  * if suboffset >= 0:
36786  * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
36787  */
36788  __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
36789  for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
36790  __pyx_t_6 = __pyx_t_8;
36791  __pyx_v_suboffset = (__pyx_t_6[0]);
36792 
36793  /* "View.MemoryView":1038
36794  * result.view.suboffsets = NULL
36795  * for suboffset in result.from_slice.suboffsets[:ndim]:
36796  * if suboffset >= 0: # <<<<<<<<<<<<<<
36797  * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
36798  * break
36799  */
36800  __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0);
36801  if (__pyx_t_1) {
36802 
36803  /* "View.MemoryView":1039
36804  * for suboffset in result.from_slice.suboffsets[:ndim]:
36805  * if suboffset >= 0:
36806  * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets # <<<<<<<<<<<<<<
36807  * break
36808  *
36809  */
36810  __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);
36811 
36812  /* "View.MemoryView":1040
36813  * if suboffset >= 0:
36814  * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
36815  * break # <<<<<<<<<<<<<<
36816  *
36817  * result.view.len = result.view.itemsize
36818  */
36819  goto __pyx_L6_break;
36820 
36821  /* "View.MemoryView":1038
36822  * result.view.suboffsets = NULL
36823  * for suboffset in result.from_slice.suboffsets[:ndim]:
36824  * if suboffset >= 0: # <<<<<<<<<<<<<<
36825  * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
36826  * break
36827  */
36828  }
36829  }
36830  __pyx_L6_break:;
36831 
36832  /* "View.MemoryView":1042
36833  * break
36834  *
36835  * result.view.len = result.view.itemsize # <<<<<<<<<<<<<<
36836  * for length in result.view.shape[:ndim]:
36837  * result.view.len *= length
36838  */
36839  __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
36840  __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
36841 
36842  /* "View.MemoryView":1043
36843  *
36844  * result.view.len = result.view.itemsize
36845  * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<<
36846  * result.view.len *= length
36847  *
36848  */
36849  __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
36850  for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
36851  __pyx_t_6 = __pyx_t_8;
36852  __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1043, __pyx_L1_error)
36853  __Pyx_GOTREF(__pyx_t_2);
36854  __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
36855  __pyx_t_2 = 0;
36856 
36857  /* "View.MemoryView":1044
36858  * result.view.len = result.view.itemsize
36859  * for length in result.view.shape[:ndim]:
36860  * result.view.len *= length # <<<<<<<<<<<<<<
36861  *
36862  * result.to_object_func = to_object_func
36863  */
36864  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1044, __pyx_L1_error)
36865  __Pyx_GOTREF(__pyx_t_2);
36866  __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1044, __pyx_L1_error)
36867  __Pyx_GOTREF(__pyx_t_3);
36868  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
36869  __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 1044, __pyx_L1_error)
36870  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
36871  __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
36872  }
36873 
36874  /* "View.MemoryView":1046
36875  * result.view.len *= length
36876  *
36877  * result.to_object_func = to_object_func # <<<<<<<<<<<<<<
36878  * result.to_dtype_func = to_dtype_func
36879  *
36880  */
36881  __pyx_v_result->to_object_func = __pyx_v_to_object_func;
36882 
36883  /* "View.MemoryView":1047
36884  *
36885  * result.to_object_func = to_object_func
36886  * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<<
36887  *
36888  * return result
36889  */
36890  __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;
36891 
36892  /* "View.MemoryView":1049
36893  * result.to_dtype_func = to_dtype_func
36894  *
36895  * return result # <<<<<<<<<<<<<<
36896  *
36897  * @cname('__pyx_memoryview_get_slice_from_memoryview')
36898  */
36899  __Pyx_XDECREF(__pyx_r);
36900  __Pyx_INCREF(((PyObject *)__pyx_v_result));
36901  __pyx_r = ((PyObject *)__pyx_v_result);
36902  goto __pyx_L0;
36903 
36904  /* "View.MemoryView":999
36905  *
36906  * @cname('__pyx_memoryview_fromslice')
36907  * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<<
36908  * int ndim,
36909  * object (*to_object_func)(char *),
36910  */
36911 
36912  /* function exit code */
36913  __pyx_L1_error:;
36914  __Pyx_XDECREF(__pyx_t_2);
36915  __Pyx_XDECREF(__pyx_t_3);
36916  __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
36917  __pyx_r = 0;
36918  __pyx_L0:;
36919  __Pyx_XDECREF((PyObject *)__pyx_v_result);
36920  __Pyx_XDECREF(__pyx_v_length);
36921  __Pyx_XGIVEREF(__pyx_r);
36922  __Pyx_RefNannyFinishContext();
36923  return __pyx_r;
36924 }
36925 
36926 /* "View.MemoryView":1052
36927  *
36928  * @cname('__pyx_memoryview_get_slice_from_memoryview')
36929  * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<<
36930  * __Pyx_memviewslice *mslice) except NULL:
36931  * cdef _memoryviewslice obj
36932  */
36933 
36934 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
36935  struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
36936  __Pyx_memviewslice *__pyx_r;
36937  __Pyx_RefNannyDeclarations
36938  int __pyx_t_1;
36939  int __pyx_t_2;
36940  PyObject *__pyx_t_3 = NULL;
36941  __Pyx_RefNannySetupContext("get_slice_from_memview", 0);
36942 
36943  /* "View.MemoryView":1055
36944  * __Pyx_memviewslice *mslice) except NULL:
36945  * cdef _memoryviewslice obj
36946  * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
36947  * obj = memview
36948  * return &obj.from_slice
36949  */
36950  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
36951  __pyx_t_2 = (__pyx_t_1 != 0);
36952  if (__pyx_t_2) {
36953 
36954  /* "View.MemoryView":1056
36955  * cdef _memoryviewslice obj
36956  * if isinstance(memview, _memoryviewslice):
36957  * obj = memview # <<<<<<<<<<<<<<
36958  * return &obj.from_slice
36959  * else:
36960  */
36961  if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 1056, __pyx_L1_error)
36962  __pyx_t_3 = ((PyObject *)__pyx_v_memview);
36963  __Pyx_INCREF(__pyx_t_3);
36964  __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
36965  __pyx_t_3 = 0;
36966 
36967  /* "View.MemoryView":1057
36968  * if isinstance(memview, _memoryviewslice):
36969  * obj = memview
36970  * return &obj.from_slice # <<<<<<<<<<<<<<
36971  * else:
36972  * slice_copy(memview, mslice)
36973  */
36974  __pyx_r = (&__pyx_v_obj->from_slice);
36975  goto __pyx_L0;
36976 
36977  /* "View.MemoryView":1055
36978  * __Pyx_memviewslice *mslice) except NULL:
36979  * cdef _memoryviewslice obj
36980  * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
36981  * obj = memview
36982  * return &obj.from_slice
36983  */
36984  }
36985 
36986  /* "View.MemoryView":1059
36987  * return &obj.from_slice
36988  * else:
36989  * slice_copy(memview, mslice) # <<<<<<<<<<<<<<
36990  * return mslice
36991  *
36992  */
36993  /*else*/ {
36994  __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);
36995 
36996  /* "View.MemoryView":1060
36997  * else:
36998  * slice_copy(memview, mslice)
36999  * return mslice # <<<<<<<<<<<<<<
37000  *
37001  * @cname('__pyx_memoryview_slice_copy')
37002  */
37003  __pyx_r = __pyx_v_mslice;
37004  goto __pyx_L0;
37005  }
37006 
37007  /* "View.MemoryView":1052
37008  *
37009  * @cname('__pyx_memoryview_get_slice_from_memoryview')
37010  * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<<
37011  * __Pyx_memviewslice *mslice) except NULL:
37012  * cdef _memoryviewslice obj
37013  */
37014 
37015  /* function exit code */
37016  __pyx_L1_error:;
37017  __Pyx_XDECREF(__pyx_t_3);
37018  __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
37019  __pyx_r = NULL;
37020  __pyx_L0:;
37021  __Pyx_XDECREF((PyObject *)__pyx_v_obj);
37022  __Pyx_RefNannyFinishContext();
37023  return __pyx_r;
37024 }
37025 
37026 /* "View.MemoryView":1063
37027  *
37028  * @cname('__pyx_memoryview_slice_copy')
37029  * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<<
37030  * cdef int dim
37031  * cdef (Py_ssize_t*) shape, strides, suboffsets
37032  */
37033 
37034 static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
37035  int __pyx_v_dim;
37036  Py_ssize_t *__pyx_v_shape;
37037  Py_ssize_t *__pyx_v_strides;
37038  Py_ssize_t *__pyx_v_suboffsets;
37039  __Pyx_RefNannyDeclarations
37040  Py_ssize_t *__pyx_t_1;
37041  int __pyx_t_2;
37042  int __pyx_t_3;
37043  int __pyx_t_4;
37044  Py_ssize_t __pyx_t_5;
37045  __Pyx_RefNannySetupContext("slice_copy", 0);
37046 
37047  /* "View.MemoryView":1067
37048  * cdef (Py_ssize_t*) shape, strides, suboffsets
37049  *
37050  * shape = memview.view.shape # <<<<<<<<<<<<<<
37051  * strides = memview.view.strides
37052  * suboffsets = memview.view.suboffsets
37053  */
37054  __pyx_t_1 = __pyx_v_memview->view.shape;
37055  __pyx_v_shape = __pyx_t_1;
37056 
37057  /* "View.MemoryView":1068
37058  *
37059  * shape = memview.view.shape
37060  * strides = memview.view.strides # <<<<<<<<<<<<<<
37061  * suboffsets = memview.view.suboffsets
37062  *
37063  */
37064  __pyx_t_1 = __pyx_v_memview->view.strides;
37065  __pyx_v_strides = __pyx_t_1;
37066 
37067  /* "View.MemoryView":1069
37068  * shape = memview.view.shape
37069  * strides = memview.view.strides
37070  * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<<
37071  *
37072  * dst.memview = <__pyx_memoryview *> memview
37073  */
37074  __pyx_t_1 = __pyx_v_memview->view.suboffsets;
37075  __pyx_v_suboffsets = __pyx_t_1;
37076 
37077  /* "View.MemoryView":1071
37078  * suboffsets = memview.view.suboffsets
37079  *
37080  * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<<
37081  * dst.data = <char *> memview.view.buf
37082  *
37083  */
37084  __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview);
37085 
37086  /* "View.MemoryView":1072
37087  *
37088  * dst.memview = <__pyx_memoryview *> memview
37089  * dst.data = <char *> memview.view.buf # <<<<<<<<<<<<<<
37090  *
37091  * for dim in range(memview.view.ndim):
37092  */
37093  __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf);
37094 
37095  /* "View.MemoryView":1074
37096  * dst.data = <char *> memview.view.buf
37097  *
37098  * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<<
37099  * dst.shape[dim] = shape[dim]
37100  * dst.strides[dim] = strides[dim]
37101  */
37102  __pyx_t_2 = __pyx_v_memview->view.ndim;
37103  __pyx_t_3 = __pyx_t_2;
37104  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
37105  __pyx_v_dim = __pyx_t_4;
37106 
37107  /* "View.MemoryView":1075
37108  *
37109  * for dim in range(memview.view.ndim):
37110  * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<<
37111  * dst.strides[dim] = strides[dim]
37112  * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
37113  */
37114  (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);
37115 
37116  /* "View.MemoryView":1076
37117  * for dim in range(memview.view.ndim):
37118  * dst.shape[dim] = shape[dim]
37119  * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<<
37120  * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
37121  *
37122  */
37123  (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);
37124 
37125  /* "View.MemoryView":1077
37126  * dst.shape[dim] = shape[dim]
37127  * dst.strides[dim] = strides[dim]
37128  * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<<
37129  *
37130  * @cname('__pyx_memoryview_copy_object')
37131  */
37132  if ((__pyx_v_suboffsets != 0)) {
37133  __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
37134  } else {
37135  __pyx_t_5 = -1L;
37136  }
37137  (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
37138  }
37139 
37140  /* "View.MemoryView":1063
37141  *
37142  * @cname('__pyx_memoryview_slice_copy')
37143  * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<<
37144  * cdef int dim
37145  * cdef (Py_ssize_t*) shape, strides, suboffsets
37146  */
37147 
37148  /* function exit code */
37149  __Pyx_RefNannyFinishContext();
37150 }
37151 
37152 /* "View.MemoryView":1080
37153  *
37154  * @cname('__pyx_memoryview_copy_object')
37155  * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<<
37156  * "Create a new memoryview object"
37157  * cdef __Pyx_memviewslice memviewslice
37158  */
37159 
37160 static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) {
37161  __Pyx_memviewslice __pyx_v_memviewslice;
37162  PyObject *__pyx_r = NULL;
37163  __Pyx_RefNannyDeclarations
37164  PyObject *__pyx_t_1 = NULL;
37165  __Pyx_RefNannySetupContext("memoryview_copy", 0);
37166 
37167  /* "View.MemoryView":1083
37168  * "Create a new memoryview object"
37169  * cdef __Pyx_memviewslice memviewslice
37170  * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<<
37171  * return memoryview_copy_from_slice(memview, &memviewslice)
37172  *
37173  */
37174  __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));
37175 
37176  /* "View.MemoryView":1084
37177  * cdef __Pyx_memviewslice memviewslice
37178  * slice_copy(memview, &memviewslice)
37179  * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<<
37180  *
37181  * @cname('__pyx_memoryview_copy_object_from_slice')
37182  */
37183  __Pyx_XDECREF(__pyx_r);
37184  __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1084, __pyx_L1_error)
37185  __Pyx_GOTREF(__pyx_t_1);
37186  __pyx_r = __pyx_t_1;
37187  __pyx_t_1 = 0;
37188  goto __pyx_L0;
37189 
37190  /* "View.MemoryView":1080
37191  *
37192  * @cname('__pyx_memoryview_copy_object')
37193  * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<<
37194  * "Create a new memoryview object"
37195  * cdef __Pyx_memviewslice memviewslice
37196  */
37197 
37198  /* function exit code */
37199  __pyx_L1_error:;
37200  __Pyx_XDECREF(__pyx_t_1);
37201  __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
37202  __pyx_r = 0;
37203  __pyx_L0:;
37204  __Pyx_XGIVEREF(__pyx_r);
37205  __Pyx_RefNannyFinishContext();
37206  return __pyx_r;
37207 }
37208 
37209 /* "View.MemoryView":1087
37210  *
37211  * @cname('__pyx_memoryview_copy_object_from_slice')
37212  * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<<
37213  * """
37214  * Create a new memoryview object from a given memoryview object and slice.
37215  */
37216 
37217 static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
37218  PyObject *(*__pyx_v_to_object_func)(char *);
37219  int (*__pyx_v_to_dtype_func)(char *, PyObject *);
37220  PyObject *__pyx_r = NULL;
37221  __Pyx_RefNannyDeclarations
37222  int __pyx_t_1;
37223  int __pyx_t_2;
37224  PyObject *(*__pyx_t_3)(char *);
37225  int (*__pyx_t_4)(char *, PyObject *);
37226  PyObject *__pyx_t_5 = NULL;
37227  __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0);
37228 
37229  /* "View.MemoryView":1094
37230  * cdef int (*to_dtype_func)(char *, object) except 0
37231  *
37232  * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
37233  * to_object_func = (<_memoryviewslice> memview).to_object_func
37234  * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
37235  */
37236  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
37237  __pyx_t_2 = (__pyx_t_1 != 0);
37238  if (__pyx_t_2) {
37239 
37240  /* "View.MemoryView":1095
37241  *
37242  * if isinstance(memview, _memoryviewslice):
37243  * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<<
37244  * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
37245  * else:
37246  */
37247  __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
37248  __pyx_v_to_object_func = __pyx_t_3;
37249 
37250  /* "View.MemoryView":1096
37251  * if isinstance(memview, _memoryviewslice):
37252  * to_object_func = (<_memoryviewslice> memview).to_object_func
37253  * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<<
37254  * else:
37255  * to_object_func = NULL
37256  */
37257  __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
37258  __pyx_v_to_dtype_func = __pyx_t_4;
37259 
37260  /* "View.MemoryView":1094
37261  * cdef int (*to_dtype_func)(char *, object) except 0
37262  *
37263  * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
37264  * to_object_func = (<_memoryviewslice> memview).to_object_func
37265  * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
37266  */
37267  goto __pyx_L3;
37268  }
37269 
37270  /* "View.MemoryView":1098
37271  * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
37272  * else:
37273  * to_object_func = NULL # <<<<<<<<<<<<<<
37274  * to_dtype_func = NULL
37275  *
37276  */
37277  /*else*/ {
37278  __pyx_v_to_object_func = NULL;
37279 
37280  /* "View.MemoryView":1099
37281  * else:
37282  * to_object_func = NULL
37283  * to_dtype_func = NULL # <<<<<<<<<<<<<<
37284  *
37285  * return memoryview_fromslice(memviewslice[0], memview.view.ndim,
37286  */
37287  __pyx_v_to_dtype_func = NULL;
37288  }
37289  __pyx_L3:;
37290 
37291  /* "View.MemoryView":1101
37292  * to_dtype_func = NULL
37293  *
37294  * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<<
37295  * to_object_func, to_dtype_func,
37296  * memview.dtype_is_object)
37297  */
37298  __Pyx_XDECREF(__pyx_r);
37299 
37300  /* "View.MemoryView":1103
37301  * return memoryview_fromslice(memviewslice[0], memview.view.ndim,
37302  * to_object_func, to_dtype_func,
37303  * memview.dtype_is_object) # <<<<<<<<<<<<<<
37304  *
37305  *
37306  */
37307  __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1101, __pyx_L1_error)
37308  __Pyx_GOTREF(__pyx_t_5);
37309  __pyx_r = __pyx_t_5;
37310  __pyx_t_5 = 0;
37311  goto __pyx_L0;
37312 
37313  /* "View.MemoryView":1087
37314  *
37315  * @cname('__pyx_memoryview_copy_object_from_slice')
37316  * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<<
37317  * """
37318  * Create a new memoryview object from a given memoryview object and slice.
37319  */
37320 
37321  /* function exit code */
37322  __pyx_L1_error:;
37323  __Pyx_XDECREF(__pyx_t_5);
37324  __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
37325  __pyx_r = 0;
37326  __pyx_L0:;
37327  __Pyx_XGIVEREF(__pyx_r);
37328  __Pyx_RefNannyFinishContext();
37329  return __pyx_r;
37330 }
37331 
37332 /* "View.MemoryView":1109
37333  *
37334  *
37335  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<<
37336  * if arg < 0:
37337  * return -arg
37338  */
37339 
37340 static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
37341  Py_ssize_t __pyx_r;
37342  int __pyx_t_1;
37343 
37344  /* "View.MemoryView":1110
37345  *
37346  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
37347  * if arg < 0: # <<<<<<<<<<<<<<
37348  * return -arg
37349  * else:
37350  */
37351  __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
37352  if (__pyx_t_1) {
37353 
37354  /* "View.MemoryView":1111
37355  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
37356  * if arg < 0:
37357  * return -arg # <<<<<<<<<<<<<<
37358  * else:
37359  * return arg
37360  */
37361  __pyx_r = (-__pyx_v_arg);
37362  goto __pyx_L0;
37363 
37364  /* "View.MemoryView":1110
37365  *
37366  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
37367  * if arg < 0: # <<<<<<<<<<<<<<
37368  * return -arg
37369  * else:
37370  */
37371  }
37372 
37373  /* "View.MemoryView":1113
37374  * return -arg
37375  * else:
37376  * return arg # <<<<<<<<<<<<<<
37377  *
37378  * @cname('__pyx_get_best_slice_order')
37379  */
37380  /*else*/ {
37381  __pyx_r = __pyx_v_arg;
37382  goto __pyx_L0;
37383  }
37384 
37385  /* "View.MemoryView":1109
37386  *
37387  *
37388  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<<
37389  * if arg < 0:
37390  * return -arg
37391  */
37392 
37393  /* function exit code */
37394  __pyx_L0:;
37395  return __pyx_r;
37396 }
37397 
37398 /* "View.MemoryView":1116
37399  *
37400  * @cname('__pyx_get_best_slice_order')
37401  * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<<
37402  * """
37403  * Figure out the best memory access order for a given slice.
37404  */
37405 
37406 static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) {
37407  int __pyx_v_i;
37408  Py_ssize_t __pyx_v_c_stride;
37409  Py_ssize_t __pyx_v_f_stride;
37410  char __pyx_r;
37411  int __pyx_t_1;
37412  int __pyx_t_2;
37413  int __pyx_t_3;
37414  int __pyx_t_4;
37415 
37416  /* "View.MemoryView":1121
37417  * """
37418  * cdef int i
37419  * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<<
37420  * cdef Py_ssize_t f_stride = 0
37421  *
37422  */
37423  __pyx_v_c_stride = 0;
37424 
37425  /* "View.MemoryView":1122
37426  * cdef int i
37427  * cdef Py_ssize_t c_stride = 0
37428  * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<<
37429  *
37430  * for i in range(ndim - 1, -1, -1):
37431  */
37432  __pyx_v_f_stride = 0;
37433 
37434  /* "View.MemoryView":1124
37435  * cdef Py_ssize_t f_stride = 0
37436  *
37437  * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<<
37438  * if mslice.shape[i] > 1:
37439  * c_stride = mslice.strides[i]
37440  */
37441  for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
37442  __pyx_v_i = __pyx_t_1;
37443 
37444  /* "View.MemoryView":1125
37445  *
37446  * for i in range(ndim - 1, -1, -1):
37447  * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
37448  * c_stride = mslice.strides[i]
37449  * break
37450  */
37451  __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
37452  if (__pyx_t_2) {
37453 
37454  /* "View.MemoryView":1126
37455  * for i in range(ndim - 1, -1, -1):
37456  * if mslice.shape[i] > 1:
37457  * c_stride = mslice.strides[i] # <<<<<<<<<<<<<<
37458  * break
37459  *
37460  */
37461  __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
37462 
37463  /* "View.MemoryView":1127
37464  * if mslice.shape[i] > 1:
37465  * c_stride = mslice.strides[i]
37466  * break # <<<<<<<<<<<<<<
37467  *
37468  * for i in range(ndim):
37469  */
37470  goto __pyx_L4_break;
37471 
37472  /* "View.MemoryView":1125
37473  *
37474  * for i in range(ndim - 1, -1, -1):
37475  * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
37476  * c_stride = mslice.strides[i]
37477  * break
37478  */
37479  }
37480  }
37481  __pyx_L4_break:;
37482 
37483  /* "View.MemoryView":1129
37484  * break
37485  *
37486  * for i in range(ndim): # <<<<<<<<<<<<<<
37487  * if mslice.shape[i] > 1:
37488  * f_stride = mslice.strides[i]
37489  */
37490  __pyx_t_1 = __pyx_v_ndim;
37491  __pyx_t_3 = __pyx_t_1;
37492  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
37493  __pyx_v_i = __pyx_t_4;
37494 
37495  /* "View.MemoryView":1130
37496  *
37497  * for i in range(ndim):
37498  * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
37499  * f_stride = mslice.strides[i]
37500  * break
37501  */
37502  __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
37503  if (__pyx_t_2) {
37504 
37505  /* "View.MemoryView":1131
37506  * for i in range(ndim):
37507  * if mslice.shape[i] > 1:
37508  * f_stride = mslice.strides[i] # <<<<<<<<<<<<<<
37509  * break
37510  *
37511  */
37512  __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
37513 
37514  /* "View.MemoryView":1132
37515  * if mslice.shape[i] > 1:
37516  * f_stride = mslice.strides[i]
37517  * break # <<<<<<<<<<<<<<
37518  *
37519  * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
37520  */
37521  goto __pyx_L7_break;
37522 
37523  /* "View.MemoryView":1130
37524  *
37525  * for i in range(ndim):
37526  * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
37527  * f_stride = mslice.strides[i]
37528  * break
37529  */
37530  }
37531  }
37532  __pyx_L7_break:;
37533 
37534  /* "View.MemoryView":1134
37535  * break
37536  *
37537  * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<<
37538  * return 'C'
37539  * else:
37540  */
37541  __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
37542  if (__pyx_t_2) {
37543 
37544  /* "View.MemoryView":1135
37545  *
37546  * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
37547  * return 'C' # <<<<<<<<<<<<<<
37548  * else:
37549  * return 'F'
37550  */
37551  __pyx_r = 'C';
37552  goto __pyx_L0;
37553 
37554  /* "View.MemoryView":1134
37555  * break
37556  *
37557  * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<<
37558  * return 'C'
37559  * else:
37560  */
37561  }
37562 
37563  /* "View.MemoryView":1137
37564  * return 'C'
37565  * else:
37566  * return 'F' # <<<<<<<<<<<<<<
37567  *
37568  * @cython.cdivision(True)
37569  */
37570  /*else*/ {
37571  __pyx_r = 'F';
37572  goto __pyx_L0;
37573  }
37574 
37575  /* "View.MemoryView":1116
37576  *
37577  * @cname('__pyx_get_best_slice_order')
37578  * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<<
37579  * """
37580  * Figure out the best memory access order for a given slice.
37581  */
37582 
37583  /* function exit code */
37584  __pyx_L0:;
37585  return __pyx_r;
37586 }
37587 
37588 /* "View.MemoryView":1140
37589  *
37590  * @cython.cdivision(True)
37591  * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<<
37592  * char *dst_data, Py_ssize_t *dst_strides,
37593  * Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
37594  */
37595 
37596 static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) {
37597  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
37598  CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
37599  Py_ssize_t __pyx_v_dst_extent;
37600  Py_ssize_t __pyx_v_src_stride;
37601  Py_ssize_t __pyx_v_dst_stride;
37602  int __pyx_t_1;
37603  int __pyx_t_2;
37604  int __pyx_t_3;
37605  Py_ssize_t __pyx_t_4;
37606  Py_ssize_t __pyx_t_5;
37607  Py_ssize_t __pyx_t_6;
37608 
37609  /* "View.MemoryView":1147
37610  *
37611  * cdef Py_ssize_t i
37612  * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<<
37613  * cdef Py_ssize_t dst_extent = dst_shape[0]
37614  * cdef Py_ssize_t src_stride = src_strides[0]
37615  */
37616  __pyx_v_src_extent = (__pyx_v_src_shape[0]);
37617 
37618  /* "View.MemoryView":1148
37619  * cdef Py_ssize_t i
37620  * cdef Py_ssize_t src_extent = src_shape[0]
37621  * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<<
37622  * cdef Py_ssize_t src_stride = src_strides[0]
37623  * cdef Py_ssize_t dst_stride = dst_strides[0]
37624  */
37625  __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);
37626 
37627  /* "View.MemoryView":1149
37628  * cdef Py_ssize_t src_extent = src_shape[0]
37629  * cdef Py_ssize_t dst_extent = dst_shape[0]
37630  * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<<
37631  * cdef Py_ssize_t dst_stride = dst_strides[0]
37632  *
37633  */
37634  __pyx_v_src_stride = (__pyx_v_src_strides[0]);
37635 
37636  /* "View.MemoryView":1150
37637  * cdef Py_ssize_t dst_extent = dst_shape[0]
37638  * cdef Py_ssize_t src_stride = src_strides[0]
37639  * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<<
37640  *
37641  * if ndim == 1:
37642  */
37643  __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);
37644 
37645  /* "View.MemoryView":1152
37646  * cdef Py_ssize_t dst_stride = dst_strides[0]
37647  *
37648  * if ndim == 1: # <<<<<<<<<<<<<<
37649  * if (src_stride > 0 and dst_stride > 0 and
37650  * <size_t> src_stride == itemsize == <size_t> dst_stride):
37651  */
37652  __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
37653  if (__pyx_t_1) {
37654 
37655  /* "View.MemoryView":1153
37656  *
37657  * if ndim == 1:
37658  * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<<
37659  * <size_t> src_stride == itemsize == <size_t> dst_stride):
37660  * memcpy(dst_data, src_data, itemsize * dst_extent)
37661  */
37662  __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0);
37663  if (__pyx_t_2) {
37664  } else {
37665  __pyx_t_1 = __pyx_t_2;
37666  goto __pyx_L5_bool_binop_done;
37667  }
37668  __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
37669  if (__pyx_t_2) {
37670  } else {
37671  __pyx_t_1 = __pyx_t_2;
37672  goto __pyx_L5_bool_binop_done;
37673  }
37674 
37675  /* "View.MemoryView":1154
37676  * if ndim == 1:
37677  * if (src_stride > 0 and dst_stride > 0 and
37678  * <size_t> src_stride == itemsize == <size_t> dst_stride): # <<<<<<<<<<<<<<
37679  * memcpy(dst_data, src_data, itemsize * dst_extent)
37680  * else:
37681  */
37682  __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
37683  if (__pyx_t_2) {
37684  __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
37685  }
37686  __pyx_t_3 = (__pyx_t_2 != 0);
37687  __pyx_t_1 = __pyx_t_3;
37688  __pyx_L5_bool_binop_done:;
37689 
37690  /* "View.MemoryView":1153
37691  *
37692  * if ndim == 1:
37693  * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<<
37694  * <size_t> src_stride == itemsize == <size_t> dst_stride):
37695  * memcpy(dst_data, src_data, itemsize * dst_extent)
37696  */
37697  if (__pyx_t_1) {
37698 
37699  /* "View.MemoryView":1155
37700  * if (src_stride > 0 and dst_stride > 0 and
37701  * <size_t> src_stride == itemsize == <size_t> dst_stride):
37702  * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<<
37703  * else:
37704  * for i in range(dst_extent):
37705  */
37706  (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));
37707 
37708  /* "View.MemoryView":1153
37709  *
37710  * if ndim == 1:
37711  * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<<
37712  * <size_t> src_stride == itemsize == <size_t> dst_stride):
37713  * memcpy(dst_data, src_data, itemsize * dst_extent)
37714  */
37715  goto __pyx_L4;
37716  }
37717 
37718  /* "View.MemoryView":1157
37719  * memcpy(dst_data, src_data, itemsize * dst_extent)
37720  * else:
37721  * for i in range(dst_extent): # <<<<<<<<<<<<<<
37722  * memcpy(dst_data, src_data, itemsize)
37723  * src_data += src_stride
37724  */
37725  /*else*/ {
37726  __pyx_t_4 = __pyx_v_dst_extent;
37727  __pyx_t_5 = __pyx_t_4;
37728  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
37729  __pyx_v_i = __pyx_t_6;
37730 
37731  /* "View.MemoryView":1158
37732  * else:
37733  * for i in range(dst_extent):
37734  * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<<
37735  * src_data += src_stride
37736  * dst_data += dst_stride
37737  */
37738  (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));
37739 
37740  /* "View.MemoryView":1159
37741  * for i in range(dst_extent):
37742  * memcpy(dst_data, src_data, itemsize)
37743  * src_data += src_stride # <<<<<<<<<<<<<<
37744  * dst_data += dst_stride
37745  * else:
37746  */
37747  __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
37748 
37749  /* "View.MemoryView":1160
37750  * memcpy(dst_data, src_data, itemsize)
37751  * src_data += src_stride
37752  * dst_data += dst_stride # <<<<<<<<<<<<<<
37753  * else:
37754  * for i in range(dst_extent):
37755  */
37756  __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
37757  }
37758  }
37759  __pyx_L4:;
37760 
37761  /* "View.MemoryView":1152
37762  * cdef Py_ssize_t dst_stride = dst_strides[0]
37763  *
37764  * if ndim == 1: # <<<<<<<<<<<<<<
37765  * if (src_stride > 0 and dst_stride > 0 and
37766  * <size_t> src_stride == itemsize == <size_t> dst_stride):
37767  */
37768  goto __pyx_L3;
37769  }
37770 
37771  /* "View.MemoryView":1162
37772  * dst_data += dst_stride
37773  * else:
37774  * for i in range(dst_extent): # <<<<<<<<<<<<<<
37775  * _copy_strided_to_strided(src_data, src_strides + 1,
37776  * dst_data, dst_strides + 1,
37777  */
37778  /*else*/ {
37779  __pyx_t_4 = __pyx_v_dst_extent;
37780  __pyx_t_5 = __pyx_t_4;
37781  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
37782  __pyx_v_i = __pyx_t_6;
37783 
37784  /* "View.MemoryView":1163
37785  * else:
37786  * for i in range(dst_extent):
37787  * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<<
37788  * dst_data, dst_strides + 1,
37789  * src_shape + 1, dst_shape + 1,
37790  */
37791  _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize);
37792 
37793  /* "View.MemoryView":1167
37794  * src_shape + 1, dst_shape + 1,
37795  * ndim - 1, itemsize)
37796  * src_data += src_stride # <<<<<<<<<<<<<<
37797  * dst_data += dst_stride
37798  *
37799  */
37800  __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
37801 
37802  /* "View.MemoryView":1168
37803  * ndim - 1, itemsize)
37804  * src_data += src_stride
37805  * dst_data += dst_stride # <<<<<<<<<<<<<<
37806  *
37807  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,
37808  */
37809  __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
37810  }
37811  }
37812  __pyx_L3:;
37813 
37814  /* "View.MemoryView":1140
37815  *
37816  * @cython.cdivision(True)
37817  * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<<
37818  * char *dst_data, Py_ssize_t *dst_strides,
37819  * Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
37820  */
37821 
37822  /* function exit code */
37823 }
37824 
37825 /* "View.MemoryView":1170
37826  * dst_data += dst_stride
37827  *
37828  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
37829  * __Pyx_memviewslice *dst,
37830  * int ndim, size_t itemsize) nogil:
37831  */
37832 
37833 static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) {
37834 
37835  /* "View.MemoryView":1173
37836  * __Pyx_memviewslice *dst,
37837  * int ndim, size_t itemsize) nogil:
37838  * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<<
37839  * src.shape, dst.shape, ndim, itemsize)
37840  *
37841  */
37842  _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize);
37843 
37844  /* "View.MemoryView":1170
37845  * dst_data += dst_stride
37846  *
37847  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
37848  * __Pyx_memviewslice *dst,
37849  * int ndim, size_t itemsize) nogil:
37850  */
37851 
37852  /* function exit code */
37853 }
37854 
37855 /* "View.MemoryView":1177
37856  *
37857  * @cname('__pyx_memoryview_slice_get_size')
37858  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<<
37859  * "Return the size of the memory occupied by the slice in number of bytes"
37860  * cdef Py_ssize_t shape, size = src.memview.view.itemsize
37861  */
37862 
37863 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) {
37864  Py_ssize_t __pyx_v_shape;
37865  Py_ssize_t __pyx_v_size;
37866  Py_ssize_t __pyx_r;
37867  Py_ssize_t __pyx_t_1;
37868  Py_ssize_t *__pyx_t_2;
37869  Py_ssize_t *__pyx_t_3;
37870  Py_ssize_t *__pyx_t_4;
37871 
37872  /* "View.MemoryView":1179
37873  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:
37874  * "Return the size of the memory occupied by the slice in number of bytes"
37875  * cdef Py_ssize_t shape, size = src.memview.view.itemsize # <<<<<<<<<<<<<<
37876  *
37877  * for shape in src.shape[:ndim]:
37878  */
37879  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
37880  __pyx_v_size = __pyx_t_1;
37881 
37882  /* "View.MemoryView":1181
37883  * cdef Py_ssize_t shape, size = src.memview.view.itemsize
37884  *
37885  * for shape in src.shape[:ndim]: # <<<<<<<<<<<<<<
37886  * size *= shape
37887  *
37888  */
37889  __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim);
37890  for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
37891  __pyx_t_2 = __pyx_t_4;
37892  __pyx_v_shape = (__pyx_t_2[0]);
37893 
37894  /* "View.MemoryView":1182
37895  *
37896  * for shape in src.shape[:ndim]:
37897  * size *= shape # <<<<<<<<<<<<<<
37898  *
37899  * return size
37900  */
37901  __pyx_v_size = (__pyx_v_size * __pyx_v_shape);
37902  }
37903 
37904  /* "View.MemoryView":1184
37905  * size *= shape
37906  *
37907  * return size # <<<<<<<<<<<<<<
37908  *
37909  * @cname('__pyx_fill_contig_strides_array')
37910  */
37911  __pyx_r = __pyx_v_size;
37912  goto __pyx_L0;
37913 
37914  /* "View.MemoryView":1177
37915  *
37916  * @cname('__pyx_memoryview_slice_get_size')
37917  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<<
37918  * "Return the size of the memory occupied by the slice in number of bytes"
37919  * cdef Py_ssize_t shape, size = src.memview.view.itemsize
37920  */
37921 
37922  /* function exit code */
37923  __pyx_L0:;
37924  return __pyx_r;
37925 }
37926 
37927 /* "View.MemoryView":1187
37928  *
37929  * @cname('__pyx_fill_contig_strides_array')
37930  * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<<
37931  * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
37932  * int ndim, char order) nogil:
37933  */
37934 
37935 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) {
37936  int __pyx_v_idx;
37937  Py_ssize_t __pyx_r;
37938  int __pyx_t_1;
37939  int __pyx_t_2;
37940  int __pyx_t_3;
37941  int __pyx_t_4;
37942 
37943  /* "View.MemoryView":1196
37944  * cdef int idx
37945  *
37946  * if order == 'F': # <<<<<<<<<<<<<<
37947  * for idx in range(ndim):
37948  * strides[idx] = stride
37949  */
37950  __pyx_t_1 = ((__pyx_v_order == 'F') != 0);
37951  if (__pyx_t_1) {
37952 
37953  /* "View.MemoryView":1197
37954  *
37955  * if order == 'F':
37956  * for idx in range(ndim): # <<<<<<<<<<<<<<
37957  * strides[idx] = stride
37958  * stride *= shape[idx]
37959  */
37960  __pyx_t_2 = __pyx_v_ndim;
37961  __pyx_t_3 = __pyx_t_2;
37962  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
37963  __pyx_v_idx = __pyx_t_4;
37964 
37965  /* "View.MemoryView":1198
37966  * if order == 'F':
37967  * for idx in range(ndim):
37968  * strides[idx] = stride # <<<<<<<<<<<<<<
37969  * stride *= shape[idx]
37970  * else:
37971  */
37972  (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
37973 
37974  /* "View.MemoryView":1199
37975  * for idx in range(ndim):
37976  * strides[idx] = stride
37977  * stride *= shape[idx] # <<<<<<<<<<<<<<
37978  * else:
37979  * for idx in range(ndim - 1, -1, -1):
37980  */
37981  __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
37982  }
37983 
37984  /* "View.MemoryView":1196
37985  * cdef int idx
37986  *
37987  * if order == 'F': # <<<<<<<<<<<<<<
37988  * for idx in range(ndim):
37989  * strides[idx] = stride
37990  */
37991  goto __pyx_L3;
37992  }
37993 
37994  /* "View.MemoryView":1201
37995  * stride *= shape[idx]
37996  * else:
37997  * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<<
37998  * strides[idx] = stride
37999  * stride *= shape[idx]
38000  */
38001  /*else*/ {
38002  for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
38003  __pyx_v_idx = __pyx_t_2;
38004 
38005  /* "View.MemoryView":1202
38006  * else:
38007  * for idx in range(ndim - 1, -1, -1):
38008  * strides[idx] = stride # <<<<<<<<<<<<<<
38009  * stride *= shape[idx]
38010  *
38011  */
38012  (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
38013 
38014  /* "View.MemoryView":1203
38015  * for idx in range(ndim - 1, -1, -1):
38016  * strides[idx] = stride
38017  * stride *= shape[idx] # <<<<<<<<<<<<<<
38018  *
38019  * return stride
38020  */
38021  __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
38022  }
38023  }
38024  __pyx_L3:;
38025 
38026  /* "View.MemoryView":1205
38027  * stride *= shape[idx]
38028  *
38029  * return stride # <<<<<<<<<<<<<<
38030  *
38031  * @cname('__pyx_memoryview_copy_data_to_temp')
38032  */
38033  __pyx_r = __pyx_v_stride;
38034  goto __pyx_L0;
38035 
38036  /* "View.MemoryView":1187
38037  *
38038  * @cname('__pyx_fill_contig_strides_array')
38039  * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<<
38040  * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
38041  * int ndim, char order) nogil:
38042  */
38043 
38044  /* function exit code */
38045  __pyx_L0:;
38046  return __pyx_r;
38047 }
38048 
38049 /* "View.MemoryView":1208
38050  *
38051  * @cname('__pyx_memoryview_copy_data_to_temp')
38052  * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
38053  * __Pyx_memviewslice *tmpslice,
38054  * char order,
38055  */
38056 
38057 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) {
38058  int __pyx_v_i;
38059  void *__pyx_v_result;
38060  size_t __pyx_v_itemsize;
38061  size_t __pyx_v_size;
38062  void *__pyx_r;
38063  Py_ssize_t __pyx_t_1;
38064  int __pyx_t_2;
38065  int __pyx_t_3;
38066  struct __pyx_memoryview_obj *__pyx_t_4;
38067  int __pyx_t_5;
38068  int __pyx_t_6;
38069 
38070  /* "View.MemoryView":1219
38071  * cdef void *result
38072  *
38073  * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<<
38074  * cdef size_t size = slice_get_size(src, ndim)
38075  *
38076  */
38077  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
38078  __pyx_v_itemsize = __pyx_t_1;
38079 
38080  /* "View.MemoryView":1220
38081  *
38082  * cdef size_t itemsize = src.memview.view.itemsize
38083  * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<<
38084  *
38085  * result = malloc(size)
38086  */
38087  __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);
38088 
38089  /* "View.MemoryView":1222
38090  * cdef size_t size = slice_get_size(src, ndim)
38091  *
38092  * result = malloc(size) # <<<<<<<<<<<<<<
38093  * if not result:
38094  * _err(MemoryError, NULL)
38095  */
38096  __pyx_v_result = malloc(__pyx_v_size);
38097 
38098  /* "View.MemoryView":1223
38099  *
38100  * result = malloc(size)
38101  * if not result: # <<<<<<<<<<<<<<
38102  * _err(MemoryError, NULL)
38103  *
38104  */
38105  __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
38106  if (__pyx_t_2) {
38107 
38108  /* "View.MemoryView":1224
38109  * result = malloc(size)
38110  * if not result:
38111  * _err(MemoryError, NULL) # <<<<<<<<<<<<<<
38112  *
38113  *
38114  */
38115  __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 1224, __pyx_L1_error)
38116 
38117  /* "View.MemoryView":1223
38118  *
38119  * result = malloc(size)
38120  * if not result: # <<<<<<<<<<<<<<
38121  * _err(MemoryError, NULL)
38122  *
38123  */
38124  }
38125 
38126  /* "View.MemoryView":1227
38127  *
38128  *
38129  * tmpslice.data = <char *> result # <<<<<<<<<<<<<<
38130  * tmpslice.memview = src.memview
38131  * for i in range(ndim):
38132  */
38133  __pyx_v_tmpslice->data = ((char *)__pyx_v_result);
38134 
38135  /* "View.MemoryView":1228
38136  *
38137  * tmpslice.data = <char *> result
38138  * tmpslice.memview = src.memview # <<<<<<<<<<<<<<
38139  * for i in range(ndim):
38140  * tmpslice.shape[i] = src.shape[i]
38141  */
38142  __pyx_t_4 = __pyx_v_src->memview;
38143  __pyx_v_tmpslice->memview = __pyx_t_4;
38144 
38145  /* "View.MemoryView":1229
38146  * tmpslice.data = <char *> result
38147  * tmpslice.memview = src.memview
38148  * for i in range(ndim): # <<<<<<<<<<<<<<
38149  * tmpslice.shape[i] = src.shape[i]
38150  * tmpslice.suboffsets[i] = -1
38151  */
38152  __pyx_t_3 = __pyx_v_ndim;
38153  __pyx_t_5 = __pyx_t_3;
38154  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
38155  __pyx_v_i = __pyx_t_6;
38156 
38157  /* "View.MemoryView":1230
38158  * tmpslice.memview = src.memview
38159  * for i in range(ndim):
38160  * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<<
38161  * tmpslice.suboffsets[i] = -1
38162  *
38163  */
38164  (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);
38165 
38166  /* "View.MemoryView":1231
38167  * for i in range(ndim):
38168  * tmpslice.shape[i] = src.shape[i]
38169  * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<<
38170  *
38171  * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,
38172  */
38173  (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L;
38174  }
38175 
38176  /* "View.MemoryView":1233
38177  * tmpslice.suboffsets[i] = -1
38178  *
38179  * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, # <<<<<<<<<<<<<<
38180  * ndim, order)
38181  *
38182  */
38183  (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order));
38184 
38185  /* "View.MemoryView":1237
38186  *
38187  *
38188  * for i in range(ndim): # <<<<<<<<<<<<<<
38189  * if tmpslice.shape[i] == 1:
38190  * tmpslice.strides[i] = 0
38191  */
38192  __pyx_t_3 = __pyx_v_ndim;
38193  __pyx_t_5 = __pyx_t_3;
38194  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
38195  __pyx_v_i = __pyx_t_6;
38196 
38197  /* "View.MemoryView":1238
38198  *
38199  * for i in range(ndim):
38200  * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<<
38201  * tmpslice.strides[i] = 0
38202  *
38203  */
38204  __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
38205  if (__pyx_t_2) {
38206 
38207  /* "View.MemoryView":1239
38208  * for i in range(ndim):
38209  * if tmpslice.shape[i] == 1:
38210  * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<<
38211  *
38212  * if slice_is_contig(src[0], order, ndim):
38213  */
38214  (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;
38215 
38216  /* "View.MemoryView":1238
38217  *
38218  * for i in range(ndim):
38219  * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<<
38220  * tmpslice.strides[i] = 0
38221  *
38222  */
38223  }
38224  }
38225 
38226  /* "View.MemoryView":1241
38227  * tmpslice.strides[i] = 0
38228  *
38229  * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<<
38230  * memcpy(result, src.data, size)
38231  * else:
38232  */
38233  __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0);
38234  if (__pyx_t_2) {
38235 
38236  /* "View.MemoryView":1242
38237  *
38238  * if slice_is_contig(src[0], order, ndim):
38239  * memcpy(result, src.data, size) # <<<<<<<<<<<<<<
38240  * else:
38241  * copy_strided_to_strided(src, tmpslice, ndim, itemsize)
38242  */
38243  (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));
38244 
38245  /* "View.MemoryView":1241
38246  * tmpslice.strides[i] = 0
38247  *
38248  * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<<
38249  * memcpy(result, src.data, size)
38250  * else:
38251  */
38252  goto __pyx_L9;
38253  }
38254 
38255  /* "View.MemoryView":1244
38256  * memcpy(result, src.data, size)
38257  * else:
38258  * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<<
38259  *
38260  * return result
38261  */
38262  /*else*/ {
38263  copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
38264  }
38265  __pyx_L9:;
38266 
38267  /* "View.MemoryView":1246
38268  * copy_strided_to_strided(src, tmpslice, ndim, itemsize)
38269  *
38270  * return result # <<<<<<<<<<<<<<
38271  *
38272  *
38273  */
38274  __pyx_r = __pyx_v_result;
38275  goto __pyx_L0;
38276 
38277  /* "View.MemoryView":1208
38278  *
38279  * @cname('__pyx_memoryview_copy_data_to_temp')
38280  * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
38281  * __Pyx_memviewslice *tmpslice,
38282  * char order,
38283  */
38284 
38285  /* function exit code */
38286  __pyx_L1_error:;
38287  {
38288  #ifdef WITH_THREAD
38289  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
38290  #endif
38291  __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
38292  #ifdef WITH_THREAD
38293  __Pyx_PyGILState_Release(__pyx_gilstate_save);
38294  #endif
38295  }
38296  __pyx_r = NULL;
38297  __pyx_L0:;
38298  return __pyx_r;
38299 }
38300 
38301 /* "View.MemoryView":1251
38302  *
38303  * @cname('__pyx_memoryview_err_extents')
38304  * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<<
38305  * Py_ssize_t extent2) except -1 with gil:
38306  * raise ValueError("got differing extents in dimension %d (got %d and %d)" %
38307  */
38308 
38309 static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
38310  int __pyx_r;
38311  __Pyx_RefNannyDeclarations
38312  PyObject *__pyx_t_1 = NULL;
38313  PyObject *__pyx_t_2 = NULL;
38314  PyObject *__pyx_t_3 = NULL;
38315  PyObject *__pyx_t_4 = NULL;
38316  #ifdef WITH_THREAD
38317  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
38318  #endif
38319  __Pyx_RefNannySetupContext("_err_extents", 0);
38320 
38321  /* "View.MemoryView":1254
38322  * Py_ssize_t extent2) except -1 with gil:
38323  * raise ValueError("got differing extents in dimension %d (got %d and %d)" %
38324  * (i, extent1, extent2)) # <<<<<<<<<<<<<<
38325  *
38326  * @cname('__pyx_memoryview_err_dim')
38327  */
38328  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1254, __pyx_L1_error)
38329  __Pyx_GOTREF(__pyx_t_1);
38330  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1254, __pyx_L1_error)
38331  __Pyx_GOTREF(__pyx_t_2);
38332  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1254, __pyx_L1_error)
38333  __Pyx_GOTREF(__pyx_t_3);
38334  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1254, __pyx_L1_error)
38335  __Pyx_GOTREF(__pyx_t_4);
38336  __Pyx_GIVEREF(__pyx_t_1);
38337  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
38338  __Pyx_GIVEREF(__pyx_t_2);
38339  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
38340  __Pyx_GIVEREF(__pyx_t_3);
38341  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
38342  __pyx_t_1 = 0;
38343  __pyx_t_2 = 0;
38344  __pyx_t_3 = 0;
38345 
38346  /* "View.MemoryView":1253
38347  * cdef int _err_extents(int i, Py_ssize_t extent1,
38348  * Py_ssize_t extent2) except -1 with gil:
38349  * raise ValueError("got differing extents in dimension %d (got %d and %d)" % # <<<<<<<<<<<<<<
38350  * (i, extent1, extent2))
38351  *
38352  */
38353  __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1253, __pyx_L1_error)
38354  __Pyx_GOTREF(__pyx_t_3);
38355  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
38356  __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1253, __pyx_L1_error)
38357  __Pyx_GOTREF(__pyx_t_4);
38358  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
38359  __Pyx_Raise(__pyx_t_4, 0, 0, 0);
38360  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
38361  __PYX_ERR(2, 1253, __pyx_L1_error)
38362 
38363  /* "View.MemoryView":1251
38364  *
38365  * @cname('__pyx_memoryview_err_extents')
38366  * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<<
38367  * Py_ssize_t extent2) except -1 with gil:
38368  * raise ValueError("got differing extents in dimension %d (got %d and %d)" %
38369  */
38370 
38371  /* function exit code */
38372  __pyx_L1_error:;
38373  __Pyx_XDECREF(__pyx_t_1);
38374  __Pyx_XDECREF(__pyx_t_2);
38375  __Pyx_XDECREF(__pyx_t_3);
38376  __Pyx_XDECREF(__pyx_t_4);
38377  __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
38378  __pyx_r = -1;
38379  __Pyx_RefNannyFinishContext();
38380  #ifdef WITH_THREAD
38381  __Pyx_PyGILState_Release(__pyx_gilstate_save);
38382  #endif
38383  return __pyx_r;
38384 }
38385 
38386 /* "View.MemoryView":1257
38387  *
38388  * @cname('__pyx_memoryview_err_dim')
38389  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<<
38390  * raise error(msg.decode('ascii') % dim)
38391  *
38392  */
38393 
38394 static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) {
38395  int __pyx_r;
38396  __Pyx_RefNannyDeclarations
38397  PyObject *__pyx_t_1 = NULL;
38398  PyObject *__pyx_t_2 = NULL;
38399  PyObject *__pyx_t_3 = NULL;
38400  PyObject *__pyx_t_4 = NULL;
38401  #ifdef WITH_THREAD
38402  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
38403  #endif
38404  __Pyx_RefNannySetupContext("_err_dim", 0);
38405  __Pyx_INCREF(__pyx_v_error);
38406 
38407  /* "View.MemoryView":1258
38408  * @cname('__pyx_memoryview_err_dim')
38409  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:
38410  * raise error(msg.decode('ascii') % dim) # <<<<<<<<<<<<<<
38411  *
38412  * @cname('__pyx_memoryview_err')
38413  */
38414  __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1258, __pyx_L1_error)
38415  __Pyx_GOTREF(__pyx_t_2);
38416  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1258, __pyx_L1_error)
38417  __Pyx_GOTREF(__pyx_t_3);
38418  __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1258, __pyx_L1_error)
38419  __Pyx_GOTREF(__pyx_t_4);
38420  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
38421  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
38422  __Pyx_INCREF(__pyx_v_error);
38423  __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL;
38424  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
38425  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
38426  if (likely(__pyx_t_2)) {
38427  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
38428  __Pyx_INCREF(__pyx_t_2);
38429  __Pyx_INCREF(function);
38430  __Pyx_DECREF_SET(__pyx_t_3, function);
38431  }
38432  }
38433  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
38434  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
38435  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
38436  if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1258, __pyx_L1_error)
38437  __Pyx_GOTREF(__pyx_t_1);
38438  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
38439  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
38440  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
38441  __PYX_ERR(2, 1258, __pyx_L1_error)
38442 
38443  /* "View.MemoryView":1257
38444  *
38445  * @cname('__pyx_memoryview_err_dim')
38446  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<<
38447  * raise error(msg.decode('ascii') % dim)
38448  *
38449  */
38450 
38451  /* function exit code */
38452  __pyx_L1_error:;
38453  __Pyx_XDECREF(__pyx_t_1);
38454  __Pyx_XDECREF(__pyx_t_2);
38455  __Pyx_XDECREF(__pyx_t_3);
38456  __Pyx_XDECREF(__pyx_t_4);
38457  __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
38458  __pyx_r = -1;
38459  __Pyx_XDECREF(__pyx_v_error);
38460  __Pyx_RefNannyFinishContext();
38461  #ifdef WITH_THREAD
38462  __Pyx_PyGILState_Release(__pyx_gilstate_save);
38463  #endif
38464  return __pyx_r;
38465 }
38466 
38467 /* "View.MemoryView":1261
38468  *
38469  * @cname('__pyx_memoryview_err')
38470  * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<<
38471  * if msg != NULL:
38472  * raise error(msg.decode('ascii'))
38473  */
38474 
38475 static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
38476  int __pyx_r;
38477  __Pyx_RefNannyDeclarations
38478  int __pyx_t_1;
38479  PyObject *__pyx_t_2 = NULL;
38480  PyObject *__pyx_t_3 = NULL;
38481  PyObject *__pyx_t_4 = NULL;
38482  PyObject *__pyx_t_5 = NULL;
38483  #ifdef WITH_THREAD
38484  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
38485  #endif
38486  __Pyx_RefNannySetupContext("_err", 0);
38487  __Pyx_INCREF(__pyx_v_error);
38488 
38489  /* "View.MemoryView":1262
38490  * @cname('__pyx_memoryview_err')
38491  * cdef int _err(object error, char *msg) except -1 with gil:
38492  * if msg != NULL: # <<<<<<<<<<<<<<
38493  * raise error(msg.decode('ascii'))
38494  * else:
38495  */
38496  __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
38497  if (unlikely(__pyx_t_1)) {
38498 
38499  /* "View.MemoryView":1263
38500  * cdef int _err(object error, char *msg) except -1 with gil:
38501  * if msg != NULL:
38502  * raise error(msg.decode('ascii')) # <<<<<<<<<<<<<<
38503  * else:
38504  * raise error
38505  */
38506  __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1263, __pyx_L1_error)
38507  __Pyx_GOTREF(__pyx_t_3);
38508  __Pyx_INCREF(__pyx_v_error);
38509  __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL;
38510  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
38511  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
38512  if (likely(__pyx_t_5)) {
38513  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
38514  __Pyx_INCREF(__pyx_t_5);
38515  __Pyx_INCREF(function);
38516  __Pyx_DECREF_SET(__pyx_t_4, function);
38517  }
38518  }
38519  __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
38520  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
38521  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
38522  if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1263, __pyx_L1_error)
38523  __Pyx_GOTREF(__pyx_t_2);
38524  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
38525  __Pyx_Raise(__pyx_t_2, 0, 0, 0);
38526  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
38527  __PYX_ERR(2, 1263, __pyx_L1_error)
38528 
38529  /* "View.MemoryView":1262
38530  * @cname('__pyx_memoryview_err')
38531  * cdef int _err(object error, char *msg) except -1 with gil:
38532  * if msg != NULL: # <<<<<<<<<<<<<<
38533  * raise error(msg.decode('ascii'))
38534  * else:
38535  */
38536  }
38537 
38538  /* "View.MemoryView":1265
38539  * raise error(msg.decode('ascii'))
38540  * else:
38541  * raise error # <<<<<<<<<<<<<<
38542  *
38543  * @cname('__pyx_memoryview_copy_contents')
38544  */
38545  /*else*/ {
38546  __Pyx_Raise(__pyx_v_error, 0, 0, 0);
38547  __PYX_ERR(2, 1265, __pyx_L1_error)
38548  }
38549 
38550  /* "View.MemoryView":1261
38551  *
38552  * @cname('__pyx_memoryview_err')
38553  * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<<
38554  * if msg != NULL:
38555  * raise error(msg.decode('ascii'))
38556  */
38557 
38558  /* function exit code */
38559  __pyx_L1_error:;
38560  __Pyx_XDECREF(__pyx_t_2);
38561  __Pyx_XDECREF(__pyx_t_3);
38562  __Pyx_XDECREF(__pyx_t_4);
38563  __Pyx_XDECREF(__pyx_t_5);
38564  __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
38565  __pyx_r = -1;
38566  __Pyx_XDECREF(__pyx_v_error);
38567  __Pyx_RefNannyFinishContext();
38568  #ifdef WITH_THREAD
38569  __Pyx_PyGILState_Release(__pyx_gilstate_save);
38570  #endif
38571  return __pyx_r;
38572 }
38573 
38574 /* "View.MemoryView":1268
38575  *
38576  * @cname('__pyx_memoryview_copy_contents')
38577  * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<<
38578  * __Pyx_memviewslice dst,
38579  * int src_ndim, int dst_ndim,
38580  */
38581 
38582 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) {
38583  void *__pyx_v_tmpdata;
38584  size_t __pyx_v_itemsize;
38585  int __pyx_v_i;
38586  char __pyx_v_order;
38587  int __pyx_v_broadcasting;
38588  int __pyx_v_direct_copy;
38589  __Pyx_memviewslice __pyx_v_tmp;
38590  int __pyx_v_ndim;
38591  int __pyx_r;
38592  Py_ssize_t __pyx_t_1;
38593  int __pyx_t_2;
38594  int __pyx_t_3;
38595  int __pyx_t_4;
38596  int __pyx_t_5;
38597  int __pyx_t_6;
38598  void *__pyx_t_7;
38599  int __pyx_t_8;
38600 
38601  /* "View.MemoryView":1276
38602  * Check for overlapping memory and verify the shapes.
38603  * """
38604  * cdef void *tmpdata = NULL # <<<<<<<<<<<<<<
38605  * cdef size_t itemsize = src.memview.view.itemsize
38606  * cdef int i
38607  */
38608  __pyx_v_tmpdata = NULL;
38609 
38610  /* "View.MemoryView":1277
38611  * """
38612  * cdef void *tmpdata = NULL
38613  * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<<
38614  * cdef int i
38615  * cdef char order = get_best_order(&src, src_ndim)
38616  */
38617  __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
38618  __pyx_v_itemsize = __pyx_t_1;
38619 
38620  /* "View.MemoryView":1279
38621  * cdef size_t itemsize = src.memview.view.itemsize
38622  * cdef int i
38623  * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<<
38624  * cdef bint broadcasting = False
38625  * cdef bint direct_copy = False
38626  */
38627  __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);
38628 
38629  /* "View.MemoryView":1280
38630  * cdef int i
38631  * cdef char order = get_best_order(&src, src_ndim)
38632  * cdef bint broadcasting = False # <<<<<<<<<<<<<<
38633  * cdef bint direct_copy = False
38634  * cdef __Pyx_memviewslice tmp
38635  */
38636  __pyx_v_broadcasting = 0;
38637 
38638  /* "View.MemoryView":1281
38639  * cdef char order = get_best_order(&src, src_ndim)
38640  * cdef bint broadcasting = False
38641  * cdef bint direct_copy = False # <<<<<<<<<<<<<<
38642  * cdef __Pyx_memviewslice tmp
38643  *
38644  */
38645  __pyx_v_direct_copy = 0;
38646 
38647  /* "View.MemoryView":1284
38648  * cdef __Pyx_memviewslice tmp
38649  *
38650  * if src_ndim < dst_ndim: # <<<<<<<<<<<<<<
38651  * broadcast_leading(&src, src_ndim, dst_ndim)
38652  * elif dst_ndim < src_ndim:
38653  */
38654  __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
38655  if (__pyx_t_2) {
38656 
38657  /* "View.MemoryView":1285
38658  *
38659  * if src_ndim < dst_ndim:
38660  * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<<
38661  * elif dst_ndim < src_ndim:
38662  * broadcast_leading(&dst, dst_ndim, src_ndim)
38663  */
38664  __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);
38665 
38666  /* "View.MemoryView":1284
38667  * cdef __Pyx_memviewslice tmp
38668  *
38669  * if src_ndim < dst_ndim: # <<<<<<<<<<<<<<
38670  * broadcast_leading(&src, src_ndim, dst_ndim)
38671  * elif dst_ndim < src_ndim:
38672  */
38673  goto __pyx_L3;
38674  }
38675 
38676  /* "View.MemoryView":1286
38677  * if src_ndim < dst_ndim:
38678  * broadcast_leading(&src, src_ndim, dst_ndim)
38679  * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<<
38680  * broadcast_leading(&dst, dst_ndim, src_ndim)
38681  *
38682  */
38683  __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
38684  if (__pyx_t_2) {
38685 
38686  /* "View.MemoryView":1287
38687  * broadcast_leading(&src, src_ndim, dst_ndim)
38688  * elif dst_ndim < src_ndim:
38689  * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<<
38690  *
38691  * cdef int ndim = max(src_ndim, dst_ndim)
38692  */
38693  __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);
38694 
38695  /* "View.MemoryView":1286
38696  * if src_ndim < dst_ndim:
38697  * broadcast_leading(&src, src_ndim, dst_ndim)
38698  * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<<
38699  * broadcast_leading(&dst, dst_ndim, src_ndim)
38700  *
38701  */
38702  }
38703  __pyx_L3:;
38704 
38705  /* "View.MemoryView":1289
38706  * broadcast_leading(&dst, dst_ndim, src_ndim)
38707  *
38708  * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<<
38709  *
38710  * for i in range(ndim):
38711  */
38712  __pyx_t_3 = __pyx_v_dst_ndim;
38713  __pyx_t_4 = __pyx_v_src_ndim;
38714  if (((__pyx_t_3 > __pyx_t_4) != 0)) {
38715  __pyx_t_5 = __pyx_t_3;
38716  } else {
38717  __pyx_t_5 = __pyx_t_4;
38718  }
38719  __pyx_v_ndim = __pyx_t_5;
38720 
38721  /* "View.MemoryView":1291
38722  * cdef int ndim = max(src_ndim, dst_ndim)
38723  *
38724  * for i in range(ndim): # <<<<<<<<<<<<<<
38725  * if src.shape[i] != dst.shape[i]:
38726  * if src.shape[i] == 1:
38727  */
38728  __pyx_t_5 = __pyx_v_ndim;
38729  __pyx_t_3 = __pyx_t_5;
38730  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
38731  __pyx_v_i = __pyx_t_4;
38732 
38733  /* "View.MemoryView":1292
38734  *
38735  * for i in range(ndim):
38736  * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<<
38737  * if src.shape[i] == 1:
38738  * broadcasting = True
38739  */
38740  __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
38741  if (__pyx_t_2) {
38742 
38743  /* "View.MemoryView":1293
38744  * for i in range(ndim):
38745  * if src.shape[i] != dst.shape[i]:
38746  * if src.shape[i] == 1: # <<<<<<<<<<<<<<
38747  * broadcasting = True
38748  * src.strides[i] = 0
38749  */
38750  __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
38751  if (__pyx_t_2) {
38752 
38753  /* "View.MemoryView":1294
38754  * if src.shape[i] != dst.shape[i]:
38755  * if src.shape[i] == 1:
38756  * broadcasting = True # <<<<<<<<<<<<<<
38757  * src.strides[i] = 0
38758  * else:
38759  */
38760  __pyx_v_broadcasting = 1;
38761 
38762  /* "View.MemoryView":1295
38763  * if src.shape[i] == 1:
38764  * broadcasting = True
38765  * src.strides[i] = 0 # <<<<<<<<<<<<<<
38766  * else:
38767  * _err_extents(i, dst.shape[i], src.shape[i])
38768  */
38769  (__pyx_v_src.strides[__pyx_v_i]) = 0;
38770 
38771  /* "View.MemoryView":1293
38772  * for i in range(ndim):
38773  * if src.shape[i] != dst.shape[i]:
38774  * if src.shape[i] == 1: # <<<<<<<<<<<<<<
38775  * broadcasting = True
38776  * src.strides[i] = 0
38777  */
38778  goto __pyx_L7;
38779  }
38780 
38781  /* "View.MemoryView":1297
38782  * src.strides[i] = 0
38783  * else:
38784  * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<<
38785  *
38786  * if src.suboffsets[i] >= 0:
38787  */
38788  /*else*/ {
38789  __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1297, __pyx_L1_error)
38790  }
38791  __pyx_L7:;
38792 
38793  /* "View.MemoryView":1292
38794  *
38795  * for i in range(ndim):
38796  * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<<
38797  * if src.shape[i] == 1:
38798  * broadcasting = True
38799  */
38800  }
38801 
38802  /* "View.MemoryView":1299
38803  * _err_extents(i, dst.shape[i], src.shape[i])
38804  *
38805  * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<<
38806  * _err_dim(ValueError, "Dimension %d is not direct", i)
38807  *
38808  */
38809  __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
38810  if (__pyx_t_2) {
38811 
38812  /* "View.MemoryView":1300
38813  *
38814  * if src.suboffsets[i] >= 0:
38815  * _err_dim(ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<<
38816  *
38817  * if slices_overlap(&src, &dst, ndim, itemsize):
38818  */
38819  __pyx_t_6 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Dimension %d is not direct"), __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1300, __pyx_L1_error)
38820 
38821  /* "View.MemoryView":1299
38822  * _err_extents(i, dst.shape[i], src.shape[i])
38823  *
38824  * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<<
38825  * _err_dim(ValueError, "Dimension %d is not direct", i)
38826  *
38827  */
38828  }
38829  }
38830 
38831  /* "View.MemoryView":1302
38832  * _err_dim(ValueError, "Dimension %d is not direct", i)
38833  *
38834  * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<<
38835  *
38836  * if not slice_is_contig(src, order, ndim):
38837  */
38838  __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
38839  if (__pyx_t_2) {
38840 
38841  /* "View.MemoryView":1304
38842  * if slices_overlap(&src, &dst, ndim, itemsize):
38843  *
38844  * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<<
38845  * order = get_best_order(&dst, ndim)
38846  *
38847  */
38848  __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
38849  if (__pyx_t_2) {
38850 
38851  /* "View.MemoryView":1305
38852  *
38853  * if not slice_is_contig(src, order, ndim):
38854  * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<<
38855  *
38856  * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
38857  */
38858  __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);
38859 
38860  /* "View.MemoryView":1304
38861  * if slices_overlap(&src, &dst, ndim, itemsize):
38862  *
38863  * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<<
38864  * order = get_best_order(&dst, ndim)
38865  *
38866  */
38867  }
38868 
38869  /* "View.MemoryView":1307
38870  * order = get_best_order(&dst, ndim)
38871  *
38872  * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<<
38873  * src = tmp
38874  *
38875  */
38876  __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(2, 1307, __pyx_L1_error)
38877  __pyx_v_tmpdata = __pyx_t_7;
38878 
38879  /* "View.MemoryView":1308
38880  *
38881  * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
38882  * src = tmp # <<<<<<<<<<<<<<
38883  *
38884  * if not broadcasting:
38885  */
38886  __pyx_v_src = __pyx_v_tmp;
38887 
38888  /* "View.MemoryView":1302
38889  * _err_dim(ValueError, "Dimension %d is not direct", i)
38890  *
38891  * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<<
38892  *
38893  * if not slice_is_contig(src, order, ndim):
38894  */
38895  }
38896 
38897  /* "View.MemoryView":1310
38898  * src = tmp
38899  *
38900  * if not broadcasting: # <<<<<<<<<<<<<<
38901  *
38902  *
38903  */
38904  __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
38905  if (__pyx_t_2) {
38906 
38907  /* "View.MemoryView":1313
38908  *
38909  *
38910  * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<<
38911  * direct_copy = slice_is_contig(dst, 'C', ndim)
38912  * elif slice_is_contig(src, 'F', ndim):
38913  */
38914  __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim) != 0);
38915  if (__pyx_t_2) {
38916 
38917  /* "View.MemoryView":1314
38918  *
38919  * if slice_is_contig(src, 'C', ndim):
38920  * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<<
38921  * elif slice_is_contig(src, 'F', ndim):
38922  * direct_copy = slice_is_contig(dst, 'F', ndim)
38923  */
38924  __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim);
38925 
38926  /* "View.MemoryView":1313
38927  *
38928  *
38929  * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<<
38930  * direct_copy = slice_is_contig(dst, 'C', ndim)
38931  * elif slice_is_contig(src, 'F', ndim):
38932  */
38933  goto __pyx_L12;
38934  }
38935 
38936  /* "View.MemoryView":1315
38937  * if slice_is_contig(src, 'C', ndim):
38938  * direct_copy = slice_is_contig(dst, 'C', ndim)
38939  * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<<
38940  * direct_copy = slice_is_contig(dst, 'F', ndim)
38941  *
38942  */
38943  __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim) != 0);
38944  if (__pyx_t_2) {
38945 
38946  /* "View.MemoryView":1316
38947  * direct_copy = slice_is_contig(dst, 'C', ndim)
38948  * elif slice_is_contig(src, 'F', ndim):
38949  * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<<
38950  *
38951  * if direct_copy:
38952  */
38953  __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim);
38954 
38955  /* "View.MemoryView":1315
38956  * if slice_is_contig(src, 'C', ndim):
38957  * direct_copy = slice_is_contig(dst, 'C', ndim)
38958  * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<<
38959  * direct_copy = slice_is_contig(dst, 'F', ndim)
38960  *
38961  */
38962  }
38963  __pyx_L12:;
38964 
38965  /* "View.MemoryView":1318
38966  * direct_copy = slice_is_contig(dst, 'F', ndim)
38967  *
38968  * if direct_copy: # <<<<<<<<<<<<<<
38969  *
38970  * refcount_copying(&dst, dtype_is_object, ndim, False)
38971  */
38972  __pyx_t_2 = (__pyx_v_direct_copy != 0);
38973  if (__pyx_t_2) {
38974 
38975  /* "View.MemoryView":1320
38976  * if direct_copy:
38977  *
38978  * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<<
38979  * memcpy(dst.data, src.data, slice_get_size(&src, ndim))
38980  * refcount_copying(&dst, dtype_is_object, ndim, True)
38981  */
38982  __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
38983 
38984  /* "View.MemoryView":1321
38985  *
38986  * refcount_copying(&dst, dtype_is_object, ndim, False)
38987  * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<<
38988  * refcount_copying(&dst, dtype_is_object, ndim, True)
38989  * free(tmpdata)
38990  */
38991  (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)));
38992 
38993  /* "View.MemoryView":1322
38994  * refcount_copying(&dst, dtype_is_object, ndim, False)
38995  * memcpy(dst.data, src.data, slice_get_size(&src, ndim))
38996  * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<<
38997  * free(tmpdata)
38998  * return 0
38999  */
39000  __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
39001 
39002  /* "View.MemoryView":1323
39003  * memcpy(dst.data, src.data, slice_get_size(&src, ndim))
39004  * refcount_copying(&dst, dtype_is_object, ndim, True)
39005  * free(tmpdata) # <<<<<<<<<<<<<<
39006  * return 0
39007  *
39008  */
39009  free(__pyx_v_tmpdata);
39010 
39011  /* "View.MemoryView":1324
39012  * refcount_copying(&dst, dtype_is_object, ndim, True)
39013  * free(tmpdata)
39014  * return 0 # <<<<<<<<<<<<<<
39015  *
39016  * if order == 'F' == get_best_order(&dst, ndim):
39017  */
39018  __pyx_r = 0;
39019  goto __pyx_L0;
39020 
39021  /* "View.MemoryView":1318
39022  * direct_copy = slice_is_contig(dst, 'F', ndim)
39023  *
39024  * if direct_copy: # <<<<<<<<<<<<<<
39025  *
39026  * refcount_copying(&dst, dtype_is_object, ndim, False)
39027  */
39028  }
39029 
39030  /* "View.MemoryView":1310
39031  * src = tmp
39032  *
39033  * if not broadcasting: # <<<<<<<<<<<<<<
39034  *
39035  *
39036  */
39037  }
39038 
39039  /* "View.MemoryView":1326
39040  * return 0
39041  *
39042  * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<<
39043  *
39044  *
39045  */
39046  __pyx_t_2 = (__pyx_v_order == 'F');
39047  if (__pyx_t_2) {
39048  __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
39049  }
39050  __pyx_t_8 = (__pyx_t_2 != 0);
39051  if (__pyx_t_8) {
39052 
39053  /* "View.MemoryView":1329
39054  *
39055  *
39056  * transpose_memslice(&src) # <<<<<<<<<<<<<<
39057  * transpose_memslice(&dst)
39058  *
39059  */
39060  __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1329, __pyx_L1_error)
39061 
39062  /* "View.MemoryView":1330
39063  *
39064  * transpose_memslice(&src)
39065  * transpose_memslice(&dst) # <<<<<<<<<<<<<<
39066  *
39067  * refcount_copying(&dst, dtype_is_object, ndim, False)
39068  */
39069  __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1330, __pyx_L1_error)
39070 
39071  /* "View.MemoryView":1326
39072  * return 0
39073  *
39074  * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<<
39075  *
39076  *
39077  */
39078  }
39079 
39080  /* "View.MemoryView":1332
39081  * transpose_memslice(&dst)
39082  *
39083  * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<<
39084  * copy_strided_to_strided(&src, &dst, ndim, itemsize)
39085  * refcount_copying(&dst, dtype_is_object, ndim, True)
39086  */
39087  __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
39088 
39089  /* "View.MemoryView":1333
39090  *
39091  * refcount_copying(&dst, dtype_is_object, ndim, False)
39092  * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<<
39093  * refcount_copying(&dst, dtype_is_object, ndim, True)
39094  *
39095  */
39096  copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
39097 
39098  /* "View.MemoryView":1334
39099  * refcount_copying(&dst, dtype_is_object, ndim, False)
39100  * copy_strided_to_strided(&src, &dst, ndim, itemsize)
39101  * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<<
39102  *
39103  * free(tmpdata)
39104  */
39105  __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
39106 
39107  /* "View.MemoryView":1336
39108  * refcount_copying(&dst, dtype_is_object, ndim, True)
39109  *
39110  * free(tmpdata) # <<<<<<<<<<<<<<
39111  * return 0
39112  *
39113  */
39114  free(__pyx_v_tmpdata);
39115 
39116  /* "View.MemoryView":1337
39117  *
39118  * free(tmpdata)
39119  * return 0 # <<<<<<<<<<<<<<
39120  *
39121  * @cname('__pyx_memoryview_broadcast_leading')
39122  */
39123  __pyx_r = 0;
39124  goto __pyx_L0;
39125 
39126  /* "View.MemoryView":1268
39127  *
39128  * @cname('__pyx_memoryview_copy_contents')
39129  * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<<
39130  * __Pyx_memviewslice dst,
39131  * int src_ndim, int dst_ndim,
39132  */
39133 
39134  /* function exit code */
39135  __pyx_L1_error:;
39136  {
39137  #ifdef WITH_THREAD
39138  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
39139  #endif
39140  __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
39141  #ifdef WITH_THREAD
39142  __Pyx_PyGILState_Release(__pyx_gilstate_save);
39143  #endif
39144  }
39145  __pyx_r = -1;
39146  __pyx_L0:;
39147  return __pyx_r;
39148 }
39149 
39150 /* "View.MemoryView":1340
39151  *
39152  * @cname('__pyx_memoryview_broadcast_leading')
39153  * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<<
39154  * int ndim,
39155  * int ndim_other) nogil:
39156  */
39157 
39158 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) {
39159  int __pyx_v_i;
39160  int __pyx_v_offset;
39161  int __pyx_t_1;
39162  int __pyx_t_2;
39163  int __pyx_t_3;
39164 
39165  /* "View.MemoryView":1344
39166  * int ndim_other) nogil:
39167  * cdef int i
39168  * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<<
39169  *
39170  * for i in range(ndim - 1, -1, -1):
39171  */
39172  __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);
39173 
39174  /* "View.MemoryView":1346
39175  * cdef int offset = ndim_other - ndim
39176  *
39177  * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<<
39178  * mslice.shape[i + offset] = mslice.shape[i]
39179  * mslice.strides[i + offset] = mslice.strides[i]
39180  */
39181  for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
39182  __pyx_v_i = __pyx_t_1;
39183 
39184  /* "View.MemoryView":1347
39185  *
39186  * for i in range(ndim - 1, -1, -1):
39187  * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<<
39188  * mslice.strides[i + offset] = mslice.strides[i]
39189  * mslice.suboffsets[i + offset] = mslice.suboffsets[i]
39190  */
39191  (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);
39192 
39193  /* "View.MemoryView":1348
39194  * for i in range(ndim - 1, -1, -1):
39195  * mslice.shape[i + offset] = mslice.shape[i]
39196  * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<<
39197  * mslice.suboffsets[i + offset] = mslice.suboffsets[i]
39198  *
39199  */
39200  (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);
39201 
39202  /* "View.MemoryView":1349
39203  * mslice.shape[i + offset] = mslice.shape[i]
39204  * mslice.strides[i + offset] = mslice.strides[i]
39205  * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<<
39206  *
39207  * for i in range(offset):
39208  */
39209  (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
39210  }
39211 
39212  /* "View.MemoryView":1351
39213  * mslice.suboffsets[i + offset] = mslice.suboffsets[i]
39214  *
39215  * for i in range(offset): # <<<<<<<<<<<<<<
39216  * mslice.shape[i] = 1
39217  * mslice.strides[i] = mslice.strides[0]
39218  */
39219  __pyx_t_1 = __pyx_v_offset;
39220  __pyx_t_2 = __pyx_t_1;
39221  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
39222  __pyx_v_i = __pyx_t_3;
39223 
39224  /* "View.MemoryView":1352
39225  *
39226  * for i in range(offset):
39227  * mslice.shape[i] = 1 # <<<<<<<<<<<<<<
39228  * mslice.strides[i] = mslice.strides[0]
39229  * mslice.suboffsets[i] = -1
39230  */
39231  (__pyx_v_mslice->shape[__pyx_v_i]) = 1;
39232 
39233  /* "View.MemoryView":1353
39234  * for i in range(offset):
39235  * mslice.shape[i] = 1
39236  * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<<
39237  * mslice.suboffsets[i] = -1
39238  *
39239  */
39240  (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);
39241 
39242  /* "View.MemoryView":1354
39243  * mslice.shape[i] = 1
39244  * mslice.strides[i] = mslice.strides[0]
39245  * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<<
39246  *
39247  *
39248  */
39249  (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L;
39250  }
39251 
39252  /* "View.MemoryView":1340
39253  *
39254  * @cname('__pyx_memoryview_broadcast_leading')
39255  * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<<
39256  * int ndim,
39257  * int ndim_other) nogil:
39258  */
39259 
39260  /* function exit code */
39261 }
39262 
39263 /* "View.MemoryView":1362
39264  *
39265  * @cname('__pyx_memoryview_refcount_copying')
39266  * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<<
39267  * int ndim, bint inc) nogil:
39268  *
39269  */
39270 
39271 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) {
39272  int __pyx_t_1;
39273 
39274  /* "View.MemoryView":1366
39275  *
39276  *
39277  * if dtype_is_object: # <<<<<<<<<<<<<<
39278  * refcount_objects_in_slice_with_gil(dst.data, dst.shape,
39279  * dst.strides, ndim, inc)
39280  */
39281  __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
39282  if (__pyx_t_1) {
39283 
39284  /* "View.MemoryView":1367
39285  *
39286  * if dtype_is_object:
39287  * refcount_objects_in_slice_with_gil(dst.data, dst.shape, # <<<<<<<<<<<<<<
39288  * dst.strides, ndim, inc)
39289  *
39290  */
39291  __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc);
39292 
39293  /* "View.MemoryView":1366
39294  *
39295  *
39296  * if dtype_is_object: # <<<<<<<<<<<<<<
39297  * refcount_objects_in_slice_with_gil(dst.data, dst.shape,
39298  * dst.strides, ndim, inc)
39299  */
39300  }
39301 
39302  /* "View.MemoryView":1362
39303  *
39304  * @cname('__pyx_memoryview_refcount_copying')
39305  * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<<
39306  * int ndim, bint inc) nogil:
39307  *
39308  */
39309 
39310  /* function exit code */
39311 }
39312 
39313 /* "View.MemoryView":1371
39314  *
39315  * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
39316  * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
39317  * Py_ssize_t *strides, int ndim,
39318  * bint inc) with gil:
39319  */
39320 
39321 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) {
39322  __Pyx_RefNannyDeclarations
39323  #ifdef WITH_THREAD
39324  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
39325  #endif
39326  __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0);
39327 
39328  /* "View.MemoryView":1374
39329  * Py_ssize_t *strides, int ndim,
39330  * bint inc) with gil:
39331  * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<<
39332  *
39333  * @cname('__pyx_memoryview_refcount_objects_in_slice')
39334  */
39335  __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);
39336 
39337  /* "View.MemoryView":1371
39338  *
39339  * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
39340  * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
39341  * Py_ssize_t *strides, int ndim,
39342  * bint inc) with gil:
39343  */
39344 
39345  /* function exit code */
39346  __Pyx_RefNannyFinishContext();
39347  #ifdef WITH_THREAD
39348  __Pyx_PyGILState_Release(__pyx_gilstate_save);
39349  #endif
39350 }
39351 
39352 /* "View.MemoryView":1377
39353  *
39354  * @cname('__pyx_memoryview_refcount_objects_in_slice')
39355  * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
39356  * Py_ssize_t *strides, int ndim, bint inc):
39357  * cdef Py_ssize_t i
39358  */
39359 
39360 static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) {
39361  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
39362  __Pyx_RefNannyDeclarations
39363  Py_ssize_t __pyx_t_1;
39364  Py_ssize_t __pyx_t_2;
39365  Py_ssize_t __pyx_t_3;
39366  int __pyx_t_4;
39367  __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0);
39368 
39369  /* "View.MemoryView":1381
39370  * cdef Py_ssize_t i
39371  *
39372  * for i in range(shape[0]): # <<<<<<<<<<<<<<
39373  * if ndim == 1:
39374  * if inc:
39375  */
39376  __pyx_t_1 = (__pyx_v_shape[0]);
39377  __pyx_t_2 = __pyx_t_1;
39378  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
39379  __pyx_v_i = __pyx_t_3;
39380 
39381  /* "View.MemoryView":1382
39382  *
39383  * for i in range(shape[0]):
39384  * if ndim == 1: # <<<<<<<<<<<<<<
39385  * if inc:
39386  * Py_INCREF((<PyObject **> data)[0])
39387  */
39388  __pyx_t_4 = ((__pyx_v_ndim == 1) != 0);
39389  if (__pyx_t_4) {
39390 
39391  /* "View.MemoryView":1383
39392  * for i in range(shape[0]):
39393  * if ndim == 1:
39394  * if inc: # <<<<<<<<<<<<<<
39395  * Py_INCREF((<PyObject **> data)[0])
39396  * else:
39397  */
39398  __pyx_t_4 = (__pyx_v_inc != 0);
39399  if (__pyx_t_4) {
39400 
39401  /* "View.MemoryView":1384
39402  * if ndim == 1:
39403  * if inc:
39404  * Py_INCREF((<PyObject **> data)[0]) # <<<<<<<<<<<<<<
39405  * else:
39406  * Py_DECREF((<PyObject **> data)[0])
39407  */
39408  Py_INCREF((((PyObject **)__pyx_v_data)[0]));
39409 
39410  /* "View.MemoryView":1383
39411  * for i in range(shape[0]):
39412  * if ndim == 1:
39413  * if inc: # <<<<<<<<<<<<<<
39414  * Py_INCREF((<PyObject **> data)[0])
39415  * else:
39416  */
39417  goto __pyx_L6;
39418  }
39419 
39420  /* "View.MemoryView":1386
39421  * Py_INCREF((<PyObject **> data)[0])
39422  * else:
39423  * Py_DECREF((<PyObject **> data)[0]) # <<<<<<<<<<<<<<
39424  * else:
39425  * refcount_objects_in_slice(data, shape + 1, strides + 1,
39426  */
39427  /*else*/ {
39428  Py_DECREF((((PyObject **)__pyx_v_data)[0]));
39429  }
39430  __pyx_L6:;
39431 
39432  /* "View.MemoryView":1382
39433  *
39434  * for i in range(shape[0]):
39435  * if ndim == 1: # <<<<<<<<<<<<<<
39436  * if inc:
39437  * Py_INCREF((<PyObject **> data)[0])
39438  */
39439  goto __pyx_L5;
39440  }
39441 
39442  /* "View.MemoryView":1388
39443  * Py_DECREF((<PyObject **> data)[0])
39444  * else:
39445  * refcount_objects_in_slice(data, shape + 1, strides + 1, # <<<<<<<<<<<<<<
39446  * ndim - 1, inc)
39447  *
39448  */
39449  /*else*/ {
39450 
39451  /* "View.MemoryView":1389
39452  * else:
39453  * refcount_objects_in_slice(data, shape + 1, strides + 1,
39454  * ndim - 1, inc) # <<<<<<<<<<<<<<
39455  *
39456  * data += strides[0]
39457  */
39458  __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
39459  }
39460  __pyx_L5:;
39461 
39462  /* "View.MemoryView":1391
39463  * ndim - 1, inc)
39464  *
39465  * data += strides[0] # <<<<<<<<<<<<<<
39466  *
39467  *
39468  */
39469  __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
39470  }
39471 
39472  /* "View.MemoryView":1377
39473  *
39474  * @cname('__pyx_memoryview_refcount_objects_in_slice')
39475  * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
39476  * Py_ssize_t *strides, int ndim, bint inc):
39477  * cdef Py_ssize_t i
39478  */
39479 
39480  /* function exit code */
39481  __Pyx_RefNannyFinishContext();
39482 }
39483 
39484 /* "View.MemoryView":1397
39485  *
39486  * @cname('__pyx_memoryview_slice_assign_scalar')
39487  * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<<
39488  * size_t itemsize, void *item,
39489  * bint dtype_is_object) nogil:
39490  */
39491 
39492 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) {
39493 
39494  /* "View.MemoryView":1400
39495  * size_t itemsize, void *item,
39496  * bint dtype_is_object) nogil:
39497  * refcount_copying(dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<<
39498  * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
39499  * itemsize, item)
39500  */
39501  __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
39502 
39503  /* "View.MemoryView":1401
39504  * bint dtype_is_object) nogil:
39505  * refcount_copying(dst, dtype_is_object, ndim, False)
39506  * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, # <<<<<<<<<<<<<<
39507  * itemsize, item)
39508  * refcount_copying(dst, dtype_is_object, ndim, True)
39509  */
39510  __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item);
39511 
39512  /* "View.MemoryView":1403
39513  * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
39514  * itemsize, item)
39515  * refcount_copying(dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<<
39516  *
39517  *
39518  */
39519  __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
39520 
39521  /* "View.MemoryView":1397
39522  *
39523  * @cname('__pyx_memoryview_slice_assign_scalar')
39524  * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<<
39525  * size_t itemsize, void *item,
39526  * bint dtype_is_object) nogil:
39527  */
39528 
39529  /* function exit code */
39530 }
39531 
39532 /* "View.MemoryView":1407
39533  *
39534  * @cname('__pyx_memoryview__slice_assign_scalar')
39535  * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
39536  * Py_ssize_t *strides, int ndim,
39537  * size_t itemsize, void *item) nogil:
39538  */
39539 
39540 static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) {
39541  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
39542  Py_ssize_t __pyx_v_stride;
39543  Py_ssize_t __pyx_v_extent;
39544  int __pyx_t_1;
39545  Py_ssize_t __pyx_t_2;
39546  Py_ssize_t __pyx_t_3;
39547  Py_ssize_t __pyx_t_4;
39548 
39549  /* "View.MemoryView":1411
39550  * size_t itemsize, void *item) nogil:
39551  * cdef Py_ssize_t i
39552  * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<<
39553  * cdef Py_ssize_t extent = shape[0]
39554  *
39555  */
39556  __pyx_v_stride = (__pyx_v_strides[0]);
39557 
39558  /* "View.MemoryView":1412
39559  * cdef Py_ssize_t i
39560  * cdef Py_ssize_t stride = strides[0]
39561  * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<<
39562  *
39563  * if ndim == 1:
39564  */
39565  __pyx_v_extent = (__pyx_v_shape[0]);
39566 
39567  /* "View.MemoryView":1414
39568  * cdef Py_ssize_t extent = shape[0]
39569  *
39570  * if ndim == 1: # <<<<<<<<<<<<<<
39571  * for i in range(extent):
39572  * memcpy(data, item, itemsize)
39573  */
39574  __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
39575  if (__pyx_t_1) {
39576 
39577  /* "View.MemoryView":1415
39578  *
39579  * if ndim == 1:
39580  * for i in range(extent): # <<<<<<<<<<<<<<
39581  * memcpy(data, item, itemsize)
39582  * data += stride
39583  */
39584  __pyx_t_2 = __pyx_v_extent;
39585  __pyx_t_3 = __pyx_t_2;
39586  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
39587  __pyx_v_i = __pyx_t_4;
39588 
39589  /* "View.MemoryView":1416
39590  * if ndim == 1:
39591  * for i in range(extent):
39592  * memcpy(data, item, itemsize) # <<<<<<<<<<<<<<
39593  * data += stride
39594  * else:
39595  */
39596  (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize));
39597 
39598  /* "View.MemoryView":1417
39599  * for i in range(extent):
39600  * memcpy(data, item, itemsize)
39601  * data += stride # <<<<<<<<<<<<<<
39602  * else:
39603  * for i in range(extent):
39604  */
39605  __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
39606  }
39607 
39608  /* "View.MemoryView":1414
39609  * cdef Py_ssize_t extent = shape[0]
39610  *
39611  * if ndim == 1: # <<<<<<<<<<<<<<
39612  * for i in range(extent):
39613  * memcpy(data, item, itemsize)
39614  */
39615  goto __pyx_L3;
39616  }
39617 
39618  /* "View.MemoryView":1419
39619  * data += stride
39620  * else:
39621  * for i in range(extent): # <<<<<<<<<<<<<<
39622  * _slice_assign_scalar(data, shape + 1, strides + 1,
39623  * ndim - 1, itemsize, item)
39624  */
39625  /*else*/ {
39626  __pyx_t_2 = __pyx_v_extent;
39627  __pyx_t_3 = __pyx_t_2;
39628  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
39629  __pyx_v_i = __pyx_t_4;
39630 
39631  /* "View.MemoryView":1420
39632  * else:
39633  * for i in range(extent):
39634  * _slice_assign_scalar(data, shape + 1, strides + 1, # <<<<<<<<<<<<<<
39635  * ndim - 1, itemsize, item)
39636  * data += stride
39637  */
39638  __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item);
39639 
39640  /* "View.MemoryView":1422
39641  * _slice_assign_scalar(data, shape + 1, strides + 1,
39642  * ndim - 1, itemsize, item)
39643  * data += stride # <<<<<<<<<<<<<<
39644  *
39645  *
39646  */
39647  __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
39648  }
39649  }
39650  __pyx_L3:;
39651 
39652  /* "View.MemoryView":1407
39653  *
39654  * @cname('__pyx_memoryview__slice_assign_scalar')
39655  * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
39656  * Py_ssize_t *strides, int ndim,
39657  * size_t itemsize, void *item) nogil:
39658  */
39659 
39660  /* function exit code */
39661 }
39662 
39663 /* "(tree fragment)":1
39664  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
39665  * cdef object __pyx_PickleError
39666  * cdef object __pyx_result
39667  */
39668 
39669 /* Python wrapper */
39670 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
39671 static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0};
39672 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
39673  PyObject *__pyx_v___pyx_type = 0;
39674  long __pyx_v___pyx_checksum;
39675  PyObject *__pyx_v___pyx_state = 0;
39676  PyObject *__pyx_r = 0;
39677  __Pyx_RefNannyDeclarations
39678  __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0);
39679  {
39680  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
39681  PyObject* values[3] = {0,0,0};
39682  if (unlikely(__pyx_kwds)) {
39683  Py_ssize_t kw_args;
39684  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
39685  switch (pos_args) {
39686  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
39687  CYTHON_FALLTHROUGH;
39688  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
39689  CYTHON_FALLTHROUGH;
39690  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
39691  CYTHON_FALLTHROUGH;
39692  case 0: break;
39693  default: goto __pyx_L5_argtuple_error;
39694  }
39695  kw_args = PyDict_Size(__pyx_kwds);
39696  switch (pos_args) {
39697  case 0:
39698  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
39699  else goto __pyx_L5_argtuple_error;
39700  CYTHON_FALLTHROUGH;
39701  case 1:
39702  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
39703  else {
39704  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(2, 1, __pyx_L3_error)
39705  }
39706  CYTHON_FALLTHROUGH;
39707  case 2:
39708  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
39709  else {
39710  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(2, 1, __pyx_L3_error)
39711  }
39712  }
39713  if (unlikely(kw_args > 0)) {
39714  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(2, 1, __pyx_L3_error)
39715  }
39716  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
39717  goto __pyx_L5_argtuple_error;
39718  } else {
39719  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
39720  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
39721  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
39722  }
39723  __pyx_v___pyx_type = values[0];
39724  __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(2, 1, __pyx_L3_error)
39725  __pyx_v___pyx_state = values[2];
39726  }
39727  goto __pyx_L4_argument_unpacking_done;
39728  __pyx_L5_argtuple_error:;
39729  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 1, __pyx_L3_error)
39730  __pyx_L3_error:;
39731  __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
39732  __Pyx_RefNannyFinishContext();
39733  return NULL;
39734  __pyx_L4_argument_unpacking_done:;
39735  __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
39736 
39737  /* function exit code */
39738  __Pyx_RefNannyFinishContext();
39739  return __pyx_r;
39740 }
39741 
39742 static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
39743  PyObject *__pyx_v___pyx_PickleError = 0;
39744  PyObject *__pyx_v___pyx_result = 0;
39745  PyObject *__pyx_r = NULL;
39746  __Pyx_RefNannyDeclarations
39747  int __pyx_t_1;
39748  PyObject *__pyx_t_2 = NULL;
39749  PyObject *__pyx_t_3 = NULL;
39750  PyObject *__pyx_t_4 = NULL;
39751  PyObject *__pyx_t_5 = NULL;
39752  int __pyx_t_6;
39753  __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0);
39754 
39755  /* "(tree fragment)":4
39756  * cdef object __pyx_PickleError
39757  * cdef object __pyx_result
39758  * if __pyx_checksum != 0xb068931: # <<<<<<<<<<<<<<
39759  * from pickle import PickleError as __pyx_PickleError
39760  * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
39761  */
39762  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xb068931) != 0);
39763  if (__pyx_t_1) {
39764 
39765  /* "(tree fragment)":5
39766  * cdef object __pyx_result
39767  * if __pyx_checksum != 0xb068931:
39768  * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<<
39769  * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
39770  * __pyx_result = Enum.__new__(__pyx_type)
39771  */
39772  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error)
39773  __Pyx_GOTREF(__pyx_t_2);
39774  __Pyx_INCREF(__pyx_n_s_PickleError);
39775  __Pyx_GIVEREF(__pyx_n_s_PickleError);
39776  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
39777  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error)
39778  __Pyx_GOTREF(__pyx_t_3);
39779  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
39780  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error)
39781  __Pyx_GOTREF(__pyx_t_2);
39782  __Pyx_INCREF(__pyx_t_2);
39783  __pyx_v___pyx_PickleError = __pyx_t_2;
39784  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
39785  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
39786 
39787  /* "(tree fragment)":6
39788  * if __pyx_checksum != 0xb068931:
39789  * from pickle import PickleError as __pyx_PickleError
39790  * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) # <<<<<<<<<<<<<<
39791  * __pyx_result = Enum.__new__(__pyx_type)
39792  * if __pyx_state is not None:
39793  */
39794  __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 6, __pyx_L1_error)
39795  __Pyx_GOTREF(__pyx_t_2);
39796  __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 6, __pyx_L1_error)
39797  __Pyx_GOTREF(__pyx_t_4);
39798  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
39799  __Pyx_INCREF(__pyx_v___pyx_PickleError);
39800  __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
39801  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
39802  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
39803  if (likely(__pyx_t_5)) {
39804  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
39805  __Pyx_INCREF(__pyx_t_5);
39806  __Pyx_INCREF(function);
39807  __Pyx_DECREF_SET(__pyx_t_2, function);
39808  }
39809  }
39810  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
39811  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
39812  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
39813  if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 6, __pyx_L1_error)
39814  __Pyx_GOTREF(__pyx_t_3);
39815  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
39816  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
39817  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
39818  __PYX_ERR(2, 6, __pyx_L1_error)
39819 
39820  /* "(tree fragment)":4
39821  * cdef object __pyx_PickleError
39822  * cdef object __pyx_result
39823  * if __pyx_checksum != 0xb068931: # <<<<<<<<<<<<<<
39824  * from pickle import PickleError as __pyx_PickleError
39825  * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
39826  */
39827  }
39828 
39829  /* "(tree fragment)":7
39830  * from pickle import PickleError as __pyx_PickleError
39831  * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
39832  * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<<
39833  * if __pyx_state is not None:
39834  * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
39835  */
39836  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 7, __pyx_L1_error)
39837  __Pyx_GOTREF(__pyx_t_2);
39838  __pyx_t_4 = NULL;
39839  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
39840  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
39841  if (likely(__pyx_t_4)) {
39842  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
39843  __Pyx_INCREF(__pyx_t_4);
39844  __Pyx_INCREF(function);
39845  __Pyx_DECREF_SET(__pyx_t_2, function);
39846  }
39847  }
39848  __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
39849  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
39850  if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 7, __pyx_L1_error)
39851  __Pyx_GOTREF(__pyx_t_3);
39852  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
39853  __pyx_v___pyx_result = __pyx_t_3;
39854  __pyx_t_3 = 0;
39855 
39856  /* "(tree fragment)":8
39857  * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
39858  * __pyx_result = Enum.__new__(__pyx_type)
39859  * if __pyx_state is not None: # <<<<<<<<<<<<<<
39860  * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
39861  * return __pyx_result
39862  */
39863  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
39864  __pyx_t_6 = (__pyx_t_1 != 0);
39865  if (__pyx_t_6) {
39866 
39867  /* "(tree fragment)":9
39868  * __pyx_result = Enum.__new__(__pyx_type)
39869  * if __pyx_state is not None:
39870  * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state) # <<<<<<<<<<<<<<
39871  * return __pyx_result
39872  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
39873  */
39874  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 9, __pyx_L1_error)
39875  __pyx_t_3 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 9, __pyx_L1_error)
39876  __Pyx_GOTREF(__pyx_t_3);
39877  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
39878 
39879  /* "(tree fragment)":8
39880  * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
39881  * __pyx_result = Enum.__new__(__pyx_type)
39882  * if __pyx_state is not None: # <<<<<<<<<<<<<<
39883  * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
39884  * return __pyx_result
39885  */
39886  }
39887 
39888  /* "(tree fragment)":10
39889  * if __pyx_state is not None:
39890  * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
39891  * return __pyx_result # <<<<<<<<<<<<<<
39892  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
39893  * __pyx_result.name = __pyx_state[0]
39894  */
39895  __Pyx_XDECREF(__pyx_r);
39896  __Pyx_INCREF(__pyx_v___pyx_result);
39897  __pyx_r = __pyx_v___pyx_result;
39898  goto __pyx_L0;
39899 
39900  /* "(tree fragment)":1
39901  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
39902  * cdef object __pyx_PickleError
39903  * cdef object __pyx_result
39904  */
39905 
39906  /* function exit code */
39907  __pyx_L1_error:;
39908  __Pyx_XDECREF(__pyx_t_2);
39909  __Pyx_XDECREF(__pyx_t_3);
39910  __Pyx_XDECREF(__pyx_t_4);
39911  __Pyx_XDECREF(__pyx_t_5);
39912  __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
39913  __pyx_r = NULL;
39914  __pyx_L0:;
39915  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
39916  __Pyx_XDECREF(__pyx_v___pyx_result);
39917  __Pyx_XGIVEREF(__pyx_r);
39918  __Pyx_RefNannyFinishContext();
39919  return __pyx_r;
39920 }
39921 
39922 /* "(tree fragment)":11
39923  * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
39924  * return __pyx_result
39925  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
39926  * __pyx_result.name = __pyx_state[0]
39927  * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
39928  */
39929 
39930 static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
39931  PyObject *__pyx_r = NULL;
39932  __Pyx_RefNannyDeclarations
39933  PyObject *__pyx_t_1 = NULL;
39934  int __pyx_t_2;
39935  Py_ssize_t __pyx_t_3;
39936  int __pyx_t_4;
39937  int __pyx_t_5;
39938  PyObject *__pyx_t_6 = NULL;
39939  PyObject *__pyx_t_7 = NULL;
39940  PyObject *__pyx_t_8 = NULL;
39941  __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0);
39942 
39943  /* "(tree fragment)":12
39944  * return __pyx_result
39945  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
39946  * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<<
39947  * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
39948  * __pyx_result.__dict__.update(__pyx_state[1])
39949  */
39950  if (unlikely(__pyx_v___pyx_state == Py_None)) {
39951  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
39952  __PYX_ERR(2, 12, __pyx_L1_error)
39953  }
39954  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
39955  __Pyx_GOTREF(__pyx_t_1);
39956  __Pyx_GIVEREF(__pyx_t_1);
39957  __Pyx_GOTREF(__pyx_v___pyx_result->name);
39958  __Pyx_DECREF(__pyx_v___pyx_result->name);
39959  __pyx_v___pyx_result->name = __pyx_t_1;
39960  __pyx_t_1 = 0;
39961 
39962  /* "(tree fragment)":13
39963  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
39964  * __pyx_result.name = __pyx_state[0]
39965  * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
39966  * __pyx_result.__dict__.update(__pyx_state[1])
39967  */
39968  if (unlikely(__pyx_v___pyx_state == Py_None)) {
39969  PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
39970  __PYX_ERR(2, 13, __pyx_L1_error)
39971  }
39972  __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(2, 13, __pyx_L1_error)
39973  __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
39974  if (__pyx_t_4) {
39975  } else {
39976  __pyx_t_2 = __pyx_t_4;
39977  goto __pyx_L4_bool_binop_done;
39978  }
39979  __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 13, __pyx_L1_error)
39980  __pyx_t_5 = (__pyx_t_4 != 0);
39981  __pyx_t_2 = __pyx_t_5;
39982  __pyx_L4_bool_binop_done:;
39983  if (__pyx_t_2) {
39984 
39985  /* "(tree fragment)":14
39986  * __pyx_result.name = __pyx_state[0]
39987  * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
39988  * __pyx_result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<<
39989  */
39990  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error)
39991  __Pyx_GOTREF(__pyx_t_6);
39992  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 14, __pyx_L1_error)
39993  __Pyx_GOTREF(__pyx_t_7);
39994  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
39995  if (unlikely(__pyx_v___pyx_state == Py_None)) {
39996  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
39997  __PYX_ERR(2, 14, __pyx_L1_error)
39998  }
39999  __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error)
40000  __Pyx_GOTREF(__pyx_t_6);
40001  __pyx_t_8 = NULL;
40002  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
40003  __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
40004  if (likely(__pyx_t_8)) {
40005  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
40006  __Pyx_INCREF(__pyx_t_8);
40007  __Pyx_INCREF(function);
40008  __Pyx_DECREF_SET(__pyx_t_7, function);
40009  }
40010  }
40011  __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
40012  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
40013  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
40014  if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 14, __pyx_L1_error)
40015  __Pyx_GOTREF(__pyx_t_1);
40016  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
40017  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
40018 
40019  /* "(tree fragment)":13
40020  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
40021  * __pyx_result.name = __pyx_state[0]
40022  * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
40023  * __pyx_result.__dict__.update(__pyx_state[1])
40024  */
40025  }
40026 
40027  /* "(tree fragment)":11
40028  * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
40029  * return __pyx_result
40030  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
40031  * __pyx_result.name = __pyx_state[0]
40032  * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
40033  */
40034 
40035  /* function exit code */
40036  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
40037  goto __pyx_L0;
40038  __pyx_L1_error:;
40039  __Pyx_XDECREF(__pyx_t_1);
40040  __Pyx_XDECREF(__pyx_t_6);
40041  __Pyx_XDECREF(__pyx_t_7);
40042  __Pyx_XDECREF(__pyx_t_8);
40043  __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
40044  __pyx_r = 0;
40045  __pyx_L0:;
40046  __Pyx_XGIVEREF(__pyx_r);
40047  __Pyx_RefNannyFinishContext();
40048  return __pyx_r;
40049 }
40050 
40051 /* "BufferFormatFromTypeInfo":1463
40052  *
40053  * @cname('__pyx_format_from_typeinfo')
40054  * cdef bytes format_from_typeinfo(__Pyx_TypeInfo *type): # <<<<<<<<<<<<<<
40055  * cdef __Pyx_StructField *field
40056  * cdef __pyx_typeinfo_string fmt
40057  */
40058 
40059 static PyObject *__pyx_format_from_typeinfo(__Pyx_TypeInfo *__pyx_v_type) {
40060  __Pyx_StructField *__pyx_v_field;
40061  struct __pyx_typeinfo_string __pyx_v_fmt;
40062  PyObject *__pyx_v_part = 0;
40063  PyObject *__pyx_v_result = 0;
40064  PyObject *__pyx_v_alignment = NULL;
40065  PyObject *__pyx_v_parts = NULL;
40066  PyObject *__pyx_v_extents = NULL;
40067  int __pyx_v_i;
40068  PyObject *__pyx_r = NULL;
40069  __Pyx_RefNannyDeclarations
40070  int __pyx_t_1;
40071  int __pyx_t_2;
40072  PyObject *__pyx_t_3 = NULL;
40073  __Pyx_StructField *__pyx_t_4;
40074  PyObject *__pyx_t_5 = NULL;
40075  PyObject *__pyx_t_6 = NULL;
40076  int __pyx_t_7;
40077  int __pyx_t_8;
40078  int __pyx_t_9;
40079  int __pyx_t_10;
40080  __Pyx_RefNannySetupContext("format_from_typeinfo", 0);
40081 
40082  /* "BufferFormatFromTypeInfo":1468
40083  * cdef bytes part, result
40084  *
40085  * if type.typegroup == 'S': # <<<<<<<<<<<<<<
40086  * assert type.fields != NULL and type.fields.type != NULL
40087  *
40088  */
40089  __pyx_t_1 = ((__pyx_v_type->typegroup == 'S') != 0);
40090  if (__pyx_t_1) {
40091 
40092  /* "BufferFormatFromTypeInfo":1469
40093  *
40094  * if type.typegroup == 'S':
40095  * assert type.fields != NULL and type.fields.type != NULL # <<<<<<<<<<<<<<
40096  *
40097  * if type.flags & __PYX_BUF_FLAGS_PACKED_STRUCT:
40098  */
40099  #ifndef CYTHON_WITHOUT_ASSERTIONS
40100  if (unlikely(!Py_OptimizeFlag)) {
40101  __pyx_t_2 = ((__pyx_v_type->fields != NULL) != 0);
40102  if (__pyx_t_2) {
40103  } else {
40104  __pyx_t_1 = __pyx_t_2;
40105  goto __pyx_L4_bool_binop_done;
40106  }
40107  __pyx_t_2 = ((__pyx_v_type->fields->type != NULL) != 0);
40108  __pyx_t_1 = __pyx_t_2;
40109  __pyx_L4_bool_binop_done:;
40110  if (unlikely(!__pyx_t_1)) {
40111  PyErr_SetNone(PyExc_AssertionError);
40112  __PYX_ERR(2, 1469, __pyx_L1_error)
40113  }
40114  }
40115  #endif
40116 
40117  /* "BufferFormatFromTypeInfo":1471
40118  * assert type.fields != NULL and type.fields.type != NULL
40119  *
40120  * if type.flags & __PYX_BUF_FLAGS_PACKED_STRUCT: # <<<<<<<<<<<<<<
40121  * alignment = b'^'
40122  * else:
40123  */
40124  __pyx_t_1 = ((__pyx_v_type->flags & __PYX_BUF_FLAGS_PACKED_STRUCT) != 0);
40125  if (__pyx_t_1) {
40126 
40127  /* "BufferFormatFromTypeInfo":1472
40128  *
40129  * if type.flags & __PYX_BUF_FLAGS_PACKED_STRUCT:
40130  * alignment = b'^' # <<<<<<<<<<<<<<
40131  * else:
40132  * alignment = b''
40133  */
40134  __Pyx_INCREF(__pyx_kp_b__31);
40135  __pyx_v_alignment = __pyx_kp_b__31;
40136 
40137  /* "BufferFormatFromTypeInfo":1471
40138  * assert type.fields != NULL and type.fields.type != NULL
40139  *
40140  * if type.flags & __PYX_BUF_FLAGS_PACKED_STRUCT: # <<<<<<<<<<<<<<
40141  * alignment = b'^'
40142  * else:
40143  */
40144  goto __pyx_L6;
40145  }
40146 
40147  /* "BufferFormatFromTypeInfo":1474
40148  * alignment = b'^'
40149  * else:
40150  * alignment = b'' # <<<<<<<<<<<<<<
40151  *
40152  * parts = [b"T{"]
40153  */
40154  /*else*/ {
40155  __Pyx_INCREF(__pyx_kp_b__32);
40156  __pyx_v_alignment = __pyx_kp_b__32;
40157  }
40158  __pyx_L6:;
40159 
40160  /* "BufferFormatFromTypeInfo":1476
40161  * alignment = b''
40162  *
40163  * parts = [b"T{"] # <<<<<<<<<<<<<<
40164  * field = type.fields
40165  *
40166  */
40167  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1476, __pyx_L1_error)
40168  __Pyx_GOTREF(__pyx_t_3);
40169  __Pyx_INCREF(__pyx_kp_b_T);
40170  __Pyx_GIVEREF(__pyx_kp_b_T);
40171  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_kp_b_T);
40172  __pyx_v_parts = ((PyObject*)__pyx_t_3);
40173  __pyx_t_3 = 0;
40174 
40175  /* "BufferFormatFromTypeInfo":1477
40176  *
40177  * parts = [b"T{"]
40178  * field = type.fields # <<<<<<<<<<<<<<
40179  *
40180  * while field.type:
40181  */
40182  __pyx_t_4 = __pyx_v_type->fields;
40183  __pyx_v_field = __pyx_t_4;
40184 
40185  /* "BufferFormatFromTypeInfo":1479
40186  * field = type.fields
40187  *
40188  * while field.type: # <<<<<<<<<<<<<<
40189  * part = format_from_typeinfo(field.type)
40190  * parts.append(part + b':' + field.name + b':')
40191  */
40192  while (1) {
40193  __pyx_t_1 = (__pyx_v_field->type != 0);
40194  if (!__pyx_t_1) break;
40195 
40196  /* "BufferFormatFromTypeInfo":1480
40197  *
40198  * while field.type:
40199  * part = format_from_typeinfo(field.type) # <<<<<<<<<<<<<<
40200  * parts.append(part + b':' + field.name + b':')
40201  * field += 1
40202  */
40203  __pyx_t_3 = __pyx_format_from_typeinfo(__pyx_v_field->type); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1480, __pyx_L1_error)
40204  __Pyx_GOTREF(__pyx_t_3);
40205  __Pyx_XDECREF_SET(__pyx_v_part, ((PyObject*)__pyx_t_3));
40206  __pyx_t_3 = 0;
40207 
40208  /* "BufferFormatFromTypeInfo":1481
40209  * while field.type:
40210  * part = format_from_typeinfo(field.type)
40211  * parts.append(part + b':' + field.name + b':') # <<<<<<<<<<<<<<
40212  * field += 1
40213  *
40214  */
40215  __pyx_t_3 = PyNumber_Add(__pyx_v_part, __pyx_kp_b__33); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1481, __pyx_L1_error)
40216  __Pyx_GOTREF(__pyx_t_3);
40217  __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_field->name); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1481, __pyx_L1_error)
40218  __Pyx_GOTREF(__pyx_t_5);
40219  __pyx_t_6 = PyNumber_Add(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 1481, __pyx_L1_error)
40220  __Pyx_GOTREF(__pyx_t_6);
40221  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
40222  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
40223  __pyx_t_5 = PyNumber_Add(__pyx_t_6, __pyx_kp_b__33); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1481, __pyx_L1_error)
40224  __Pyx_GOTREF(__pyx_t_5);
40225  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
40226  __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_parts, __pyx_t_5); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(2, 1481, __pyx_L1_error)
40227  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
40228 
40229  /* "BufferFormatFromTypeInfo":1482
40230  * part = format_from_typeinfo(field.type)
40231  * parts.append(part + b':' + field.name + b':')
40232  * field += 1 # <<<<<<<<<<<<<<
40233  *
40234  * result = alignment.join(parts) + b'}'
40235  */
40236  __pyx_v_field = (__pyx_v_field + 1);
40237  }
40238 
40239  /* "BufferFormatFromTypeInfo":1484
40240  * field += 1
40241  *
40242  * result = alignment.join(parts) + b'}' # <<<<<<<<<<<<<<
40243  * else:
40244  * fmt = __Pyx_TypeInfoToFormat(type)
40245  */
40246  __pyx_t_5 = __Pyx_PyBytes_Join(__pyx_v_alignment, __pyx_v_parts); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1484, __pyx_L1_error)
40247  __Pyx_GOTREF(__pyx_t_5);
40248  __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_kp_b__34); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 1484, __pyx_L1_error)
40249  __Pyx_GOTREF(__pyx_t_6);
40250  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
40251  if (!(likely(PyBytes_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_6)->tp_name), 0))) __PYX_ERR(2, 1484, __pyx_L1_error)
40252  __pyx_v_result = ((PyObject*)__pyx_t_6);
40253  __pyx_t_6 = 0;
40254 
40255  /* "BufferFormatFromTypeInfo":1468
40256  * cdef bytes part, result
40257  *
40258  * if type.typegroup == 'S': # <<<<<<<<<<<<<<
40259  * assert type.fields != NULL and type.fields.type != NULL
40260  *
40261  */
40262  goto __pyx_L3;
40263  }
40264 
40265  /* "BufferFormatFromTypeInfo":1486
40266  * result = alignment.join(parts) + b'}'
40267  * else:
40268  * fmt = __Pyx_TypeInfoToFormat(type) # <<<<<<<<<<<<<<
40269  * if type.arraysize[0]:
40270  * extents = [unicode(type.arraysize[i]) for i in range(type.ndim)]
40271  */
40272  /*else*/ {
40273  __pyx_v_fmt = __Pyx_TypeInfoToFormat(__pyx_v_type);
40274 
40275  /* "BufferFormatFromTypeInfo":1487
40276  * else:
40277  * fmt = __Pyx_TypeInfoToFormat(type)
40278  * if type.arraysize[0]: # <<<<<<<<<<<<<<
40279  * extents = [unicode(type.arraysize[i]) for i in range(type.ndim)]
40280  * result = (u"(%s)" % u','.join(extents)).encode('ascii') + fmt.string
40281  */
40282  __pyx_t_1 = ((__pyx_v_type->arraysize[0]) != 0);
40283  if (__pyx_t_1) {
40284 
40285  /* "BufferFormatFromTypeInfo":1488
40286  * fmt = __Pyx_TypeInfoToFormat(type)
40287  * if type.arraysize[0]:
40288  * extents = [unicode(type.arraysize[i]) for i in range(type.ndim)] # <<<<<<<<<<<<<<
40289  * result = (u"(%s)" % u','.join(extents)).encode('ascii') + fmt.string
40290  * else:
40291  */
40292  __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 1488, __pyx_L1_error)
40293  __Pyx_GOTREF(__pyx_t_6);
40294  __pyx_t_8 = __pyx_v_type->ndim;
40295  __pyx_t_9 = __pyx_t_8;
40296  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
40297  __pyx_v_i = __pyx_t_10;
40298  __pyx_t_5 = __Pyx_PyInt_FromSize_t((__pyx_v_type->arraysize[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1488, __pyx_L1_error)
40299  __Pyx_GOTREF(__pyx_t_5);
40300  __pyx_t_3 = __Pyx_PyObject_Unicode(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1488, __pyx_L1_error)
40301  __Pyx_GOTREF(__pyx_t_3);
40302  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
40303  if (unlikely(__Pyx_ListComp_Append(__pyx_t_6, (PyObject*)__pyx_t_3))) __PYX_ERR(2, 1488, __pyx_L1_error)
40304  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
40305  }
40306  __pyx_v_extents = ((PyObject*)__pyx_t_6);
40307  __pyx_t_6 = 0;
40308 
40309  /* "BufferFormatFromTypeInfo":1489
40310  * if type.arraysize[0]:
40311  * extents = [unicode(type.arraysize[i]) for i in range(type.ndim)]
40312  * result = (u"(%s)" % u','.join(extents)).encode('ascii') + fmt.string # <<<<<<<<<<<<<<
40313  * else:
40314  * result = fmt.string
40315  */
40316  __pyx_t_6 = PyUnicode_Join(__pyx_kp_u__35, __pyx_v_extents); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 1489, __pyx_L1_error)
40317  __Pyx_GOTREF(__pyx_t_6);
40318  __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_s, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1489, __pyx_L1_error)
40319  __Pyx_GOTREF(__pyx_t_3);
40320  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
40321  __pyx_t_6 = PyUnicode_AsASCIIString(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 1489, __pyx_L1_error)
40322  __Pyx_GOTREF(__pyx_t_6);
40323  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
40324  __pyx_t_3 = __Pyx_PyObject_FromString(__pyx_v_fmt.string); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1489, __pyx_L1_error)
40325  __Pyx_GOTREF(__pyx_t_3);
40326  __pyx_t_5 = PyNumber_Add(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1489, __pyx_L1_error)
40327  __Pyx_GOTREF(__pyx_t_5);
40328  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
40329  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
40330  if (!(likely(PyBytes_CheckExact(__pyx_t_5))||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_5)->tp_name), 0))) __PYX_ERR(2, 1489, __pyx_L1_error)
40331  __pyx_v_result = ((PyObject*)__pyx_t_5);
40332  __pyx_t_5 = 0;
40333 
40334  /* "BufferFormatFromTypeInfo":1487
40335  * else:
40336  * fmt = __Pyx_TypeInfoToFormat(type)
40337  * if type.arraysize[0]: # <<<<<<<<<<<<<<
40338  * extents = [unicode(type.arraysize[i]) for i in range(type.ndim)]
40339  * result = (u"(%s)" % u','.join(extents)).encode('ascii') + fmt.string
40340  */
40341  goto __pyx_L9;
40342  }
40343 
40344  /* "BufferFormatFromTypeInfo":1491
40345  * result = (u"(%s)" % u','.join(extents)).encode('ascii') + fmt.string
40346  * else:
40347  * result = fmt.string # <<<<<<<<<<<<<<
40348  *
40349  * return result
40350  */
40351  /*else*/ {
40352  __pyx_t_5 = __Pyx_PyObject_FromString(__pyx_v_fmt.string); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1491, __pyx_L1_error)
40353  __Pyx_GOTREF(__pyx_t_5);
40354  __pyx_v_result = ((PyObject*)__pyx_t_5);
40355  __pyx_t_5 = 0;
40356  }
40357  __pyx_L9:;
40358  }
40359  __pyx_L3:;
40360 
40361  /* "BufferFormatFromTypeInfo":1493
40362  * result = fmt.string
40363  *
40364  * return result # <<<<<<<<<<<<<<
40365  */
40366  __Pyx_XDECREF(__pyx_r);
40367  __Pyx_INCREF(__pyx_v_result);
40368  __pyx_r = __pyx_v_result;
40369  goto __pyx_L0;
40370 
40371  /* "BufferFormatFromTypeInfo":1463
40372  *
40373  * @cname('__pyx_format_from_typeinfo')
40374  * cdef bytes format_from_typeinfo(__Pyx_TypeInfo *type): # <<<<<<<<<<<<<<
40375  * cdef __Pyx_StructField *field
40376  * cdef __pyx_typeinfo_string fmt
40377  */
40378 
40379  /* function exit code */
40380  __pyx_L1_error:;
40381  __Pyx_XDECREF(__pyx_t_3);
40382  __Pyx_XDECREF(__pyx_t_5);
40383  __Pyx_XDECREF(__pyx_t_6);
40384  __Pyx_AddTraceback("BufferFormatFromTypeInfo.format_from_typeinfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
40385  __pyx_r = 0;
40386  __pyx_L0:;
40387  __Pyx_XDECREF(__pyx_v_part);
40388  __Pyx_XDECREF(__pyx_v_result);
40389  __Pyx_XDECREF(__pyx_v_alignment);
40390  __Pyx_XDECREF(__pyx_v_parts);
40391  __Pyx_XDECREF(__pyx_v_extents);
40392  __Pyx_XGIVEREF(__pyx_r);
40393  __Pyx_RefNannyFinishContext();
40394  return __pyx_r;
40395 }
40396 
40397 static struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues *__pyx_freelist_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues[8];
40398 static int __pyx_freecount_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues = 0;
40399 
40400 static PyObject *__pyx_tp_new_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
40401  PyObject *o;
40402  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues)))) {
40403  o = (PyObject*)__pyx_freelist_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues[--__pyx_freecount_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues];
40404  memset(o, 0, sizeof(struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues));
40405  (void) PyObject_INIT(o, t);
40406  } else {
40407  o = (*t->tp_alloc)(t, 0);
40408  if (unlikely(!o)) return 0;
40409  }
40410  return o;
40411 }
40412 
40413 static void __pyx_tp_dealloc_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues(PyObject *o) {
40414  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues)))) {
40415  __pyx_freelist_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues[__pyx_freecount_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues++] = ((struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues *)o);
40416  } else {
40417  (*Py_TYPE(o)->tp_free)(o);
40418  }
40419 }
40420 
40421 static PyTypeObject __pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues = {
40422  PyVarObject_HEAD_INIT(0, 0)
40423  "mprans.MeshSmoothing.__pyx_scope_struct__getNonOwnedNodeValues", /*tp_name*/
40424  sizeof(struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues), /*tp_basicsize*/
40425  0, /*tp_itemsize*/
40426  __pyx_tp_dealloc_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues, /*tp_dealloc*/
40427  #if PY_VERSION_HEX < 0x030800b4
40428  0, /*tp_print*/
40429  #endif
40430  #if PY_VERSION_HEX >= 0x030800b4
40431  0, /*tp_vectorcall_offset*/
40432  #endif
40433  0, /*tp_getattr*/
40434  0, /*tp_setattr*/
40435  #if PY_MAJOR_VERSION < 3
40436  0, /*tp_compare*/
40437  #endif
40438  #if PY_MAJOR_VERSION >= 3
40439  0, /*tp_as_async*/
40440  #endif
40441  0, /*tp_repr*/
40442  0, /*tp_as_number*/
40443  0, /*tp_as_sequence*/
40444  0, /*tp_as_mapping*/
40445  0, /*tp_hash*/
40446  0, /*tp_call*/
40447  0, /*tp_str*/
40448  0, /*tp_getattro*/
40449  0, /*tp_setattro*/
40450  0, /*tp_as_buffer*/
40451  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
40452  0, /*tp_doc*/
40453  0, /*tp_traverse*/
40454  0, /*tp_clear*/
40455  0, /*tp_richcompare*/
40456  0, /*tp_weaklistoffset*/
40457  0, /*tp_iter*/
40458  0, /*tp_iternext*/
40459  0, /*tp_methods*/
40460  0, /*tp_members*/
40461  0, /*tp_getset*/
40462  0, /*tp_base*/
40463  0, /*tp_dict*/
40464  0, /*tp_descr_get*/
40465  0, /*tp_descr_set*/
40466  0, /*tp_dictoffset*/
40467  0, /*tp_init*/
40468  0, /*tp_alloc*/
40469  __pyx_tp_new_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues, /*tp_new*/
40470  0, /*tp_free*/
40471  0, /*tp_is_gc*/
40472  0, /*tp_bases*/
40473  0, /*tp_mro*/
40474  0, /*tp_cache*/
40475  0, /*tp_subclasses*/
40476  0, /*tp_weaklist*/
40477  0, /*tp_del*/
40478  0, /*tp_version_tag*/
40479  #if PY_VERSION_HEX >= 0x030400a1
40480  0, /*tp_finalize*/
40481  #endif
40482  #if PY_VERSION_HEX >= 0x030800b1
40483  0, /*tp_vectorcall*/
40484  #endif
40485  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
40486  0, /*tp_print*/
40487  #endif
40488 };
40489 
40490 static struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr *__pyx_freelist_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr[8];
40491 static int __pyx_freecount_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr = 0;
40492 
40493 static PyObject *__pyx_tp_new_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
40494  PyObject *o;
40495  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr)))) {
40496  o = (PyObject*)__pyx_freelist_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr[--__pyx_freecount_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr];
40497  memset(o, 0, sizeof(struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr));
40498  (void) PyObject_INIT(o, t);
40499  PyObject_GC_Track(o);
40500  } else {
40501  o = (*t->tp_alloc)(t, 0);
40502  if (unlikely(!o)) return 0;
40503  }
40504  return o;
40505 }
40506 
40507 static void __pyx_tp_dealloc_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr(PyObject *o) {
40508  struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr *)o;
40509  PyObject_GC_UnTrack(o);
40510  Py_CLEAR(p->__pyx_outer_scope);
40511  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr)))) {
40512  __pyx_freelist_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr[__pyx_freecount_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr++] = ((struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr *)o);
40513  } else {
40514  (*Py_TYPE(o)->tp_free)(o);
40515  }
40516 }
40517 
40518 static int __pyx_tp_traverse_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {
40519  int e;
40520  struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr *)o;
40521  if (p->__pyx_outer_scope) {
40522  e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
40523  }
40524  return 0;
40525 }
40526 
40527 static PyTypeObject __pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr = {
40528  PyVarObject_HEAD_INIT(0, 0)
40529  "mprans.MeshSmoothing.__pyx_scope_struct_1_genexpr", /*tp_name*/
40530  sizeof(struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr), /*tp_basicsize*/
40531  0, /*tp_itemsize*/
40532  __pyx_tp_dealloc_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr, /*tp_dealloc*/
40533  #if PY_VERSION_HEX < 0x030800b4
40534  0, /*tp_print*/
40535  #endif
40536  #if PY_VERSION_HEX >= 0x030800b4
40537  0, /*tp_vectorcall_offset*/
40538  #endif
40539  0, /*tp_getattr*/
40540  0, /*tp_setattr*/
40541  #if PY_MAJOR_VERSION < 3
40542  0, /*tp_compare*/
40543  #endif
40544  #if PY_MAJOR_VERSION >= 3
40545  0, /*tp_as_async*/
40546  #endif
40547  0, /*tp_repr*/
40548  0, /*tp_as_number*/
40549  0, /*tp_as_sequence*/
40550  0, /*tp_as_mapping*/
40551  0, /*tp_hash*/
40552  0, /*tp_call*/
40553  0, /*tp_str*/
40554  0, /*tp_getattro*/
40555  0, /*tp_setattro*/
40556  0, /*tp_as_buffer*/
40557  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
40558  0, /*tp_doc*/
40559  __pyx_tp_traverse_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr, /*tp_traverse*/
40560  0, /*tp_clear*/
40561  0, /*tp_richcompare*/
40562  0, /*tp_weaklistoffset*/
40563  0, /*tp_iter*/
40564  0, /*tp_iternext*/
40565  0, /*tp_methods*/
40566  0, /*tp_members*/
40567  0, /*tp_getset*/
40568  0, /*tp_base*/
40569  0, /*tp_dict*/
40570  0, /*tp_descr_get*/
40571  0, /*tp_descr_set*/
40572  0, /*tp_dictoffset*/
40573  0, /*tp_init*/
40574  0, /*tp_alloc*/
40575  __pyx_tp_new_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr, /*tp_new*/
40576  0, /*tp_free*/
40577  0, /*tp_is_gc*/
40578  0, /*tp_bases*/
40579  0, /*tp_mro*/
40580  0, /*tp_cache*/
40581  0, /*tp_subclasses*/
40582  0, /*tp_weaklist*/
40583  0, /*tp_del*/
40584  0, /*tp_version_tag*/
40585  #if PY_VERSION_HEX >= 0x030400a1
40586  0, /*tp_finalize*/
40587  #endif
40588  #if PY_VERSION_HEX >= 0x030800b1
40589  0, /*tp_vectorcall*/
40590  #endif
40591  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
40592  0, /*tp_print*/
40593  #endif
40594 };
40595 
40596 static struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr *__pyx_freelist_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr[8];
40597 static int __pyx_freecount_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr = 0;
40598 
40599 static PyObject *__pyx_tp_new_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
40600  PyObject *o;
40601  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr)))) {
40602  o = (PyObject*)__pyx_freelist_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr[--__pyx_freecount_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr];
40603  memset(o, 0, sizeof(struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr));
40604  (void) PyObject_INIT(o, t);
40605  PyObject_GC_Track(o);
40606  } else {
40607  o = (*t->tp_alloc)(t, 0);
40608  if (unlikely(!o)) return 0;
40609  }
40610  return o;
40611 }
40612 
40613 static void __pyx_tp_dealloc_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr(PyObject *o) {
40614  struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr *)o;
40615  PyObject_GC_UnTrack(o);
40616  Py_CLEAR(p->__pyx_outer_scope);
40617  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr)))) {
40618  __pyx_freelist_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr[__pyx_freecount_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr++] = ((struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr *)o);
40619  } else {
40620  (*Py_TYPE(o)->tp_free)(o);
40621  }
40622 }
40623 
40624 static int __pyx_tp_traverse_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr(PyObject *o, visitproc v, void *a) {
40625  int e;
40626  struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr *)o;
40627  if (p->__pyx_outer_scope) {
40628  e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
40629  }
40630  return 0;
40631 }
40632 
40633 static PyTypeObject __pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr = {
40634  PyVarObject_HEAD_INIT(0, 0)
40635  "mprans.MeshSmoothing.__pyx_scope_struct_2_genexpr", /*tp_name*/
40636  sizeof(struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr), /*tp_basicsize*/
40637  0, /*tp_itemsize*/
40638  __pyx_tp_dealloc_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr, /*tp_dealloc*/
40639  #if PY_VERSION_HEX < 0x030800b4
40640  0, /*tp_print*/
40641  #endif
40642  #if PY_VERSION_HEX >= 0x030800b4
40643  0, /*tp_vectorcall_offset*/
40644  #endif
40645  0, /*tp_getattr*/
40646  0, /*tp_setattr*/
40647  #if PY_MAJOR_VERSION < 3
40648  0, /*tp_compare*/
40649  #endif
40650  #if PY_MAJOR_VERSION >= 3
40651  0, /*tp_as_async*/
40652  #endif
40653  0, /*tp_repr*/
40654  0, /*tp_as_number*/
40655  0, /*tp_as_sequence*/
40656  0, /*tp_as_mapping*/
40657  0, /*tp_hash*/
40658  0, /*tp_call*/
40659  0, /*tp_str*/
40660  0, /*tp_getattro*/
40661  0, /*tp_setattro*/
40662  0, /*tp_as_buffer*/
40663  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
40664  0, /*tp_doc*/
40665  __pyx_tp_traverse_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr, /*tp_traverse*/
40666  0, /*tp_clear*/
40667  0, /*tp_richcompare*/
40668  0, /*tp_weaklistoffset*/
40669  0, /*tp_iter*/
40670  0, /*tp_iternext*/
40671  0, /*tp_methods*/
40672  0, /*tp_members*/
40673  0, /*tp_getset*/
40674  0, /*tp_base*/
40675  0, /*tp_dict*/
40676  0, /*tp_descr_get*/
40677  0, /*tp_descr_set*/
40678  0, /*tp_dictoffset*/
40679  0, /*tp_init*/
40680  0, /*tp_alloc*/
40681  __pyx_tp_new_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr, /*tp_new*/
40682  0, /*tp_free*/
40683  0, /*tp_is_gc*/
40684  0, /*tp_bases*/
40685  0, /*tp_mro*/
40686  0, /*tp_cache*/
40687  0, /*tp_subclasses*/
40688  0, /*tp_weaklist*/
40689  0, /*tp_del*/
40690  0, /*tp_version_tag*/
40691  #if PY_VERSION_HEX >= 0x030400a1
40692  0, /*tp_finalize*/
40693  #endif
40694  #if PY_VERSION_HEX >= 0x030800b1
40695  0, /*tp_vectorcall*/
40696  #endif
40697  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
40698  0, /*tp_print*/
40699  #endif
40700 };
40701 static struct __pyx_vtabstruct_array __pyx_vtable_array;
40702 
40703 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
40704  struct __pyx_array_obj *p;
40705  PyObject *o;
40706  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
40707  o = (*t->tp_alloc)(t, 0);
40708  } else {
40709  o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
40710  }
40711  if (unlikely(!o)) return 0;
40712  p = ((struct __pyx_array_obj *)o);
40713  p->__pyx_vtab = __pyx_vtabptr_array;
40714  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
40715  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
40716  if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad;
40717  return o;
40718  bad:
40719  Py_DECREF(o); o = 0;
40720  return NULL;
40721 }
40722 
40723 static void __pyx_tp_dealloc_array(PyObject *o) {
40724  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
40725  #if CYTHON_USE_TP_FINALIZE
40726  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
40727  if (PyObject_CallFinalizerFromDealloc(o)) return;
40728  }
40729  #endif
40730  {
40731  PyObject *etype, *eval, *etb;
40732  PyErr_Fetch(&etype, &eval, &etb);
40733  ++Py_REFCNT(o);
40734  __pyx_array___dealloc__(o);
40735  --Py_REFCNT(o);
40736  PyErr_Restore(etype, eval, etb);
40737  }
40738  Py_CLEAR(p->mode);
40739  Py_CLEAR(p->_format);
40740  (*Py_TYPE(o)->tp_free)(o);
40741 }
40742 static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
40743  PyObject *r;
40744  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
40745  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
40746  Py_DECREF(x);
40747  return r;
40748 }
40749 
40750 static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
40751  if (v) {
40752  return __pyx_array___setitem__(o, i, v);
40753  }
40754  else {
40755  PyErr_Format(PyExc_NotImplementedError,
40756  "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
40757  return -1;
40758  }
40759 }
40760 
40761 static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
40762  PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n);
40763  if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
40764  PyErr_Clear();
40765  v = __pyx_array___getattr__(o, n);
40766  }
40767  return v;
40768 }
40769 
40770 static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
40771  return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
40772 }
40773 
40774 static PyMethodDef __pyx_methods_array[] = {
40775  {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
40776  {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0},
40777  {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0},
40778  {0, 0, 0, 0}
40779 };
40780 
40781 static struct PyGetSetDef __pyx_getsets_array[] = {
40782  {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0},
40783  {0, 0, 0, 0, 0}
40784 };
40785 
40786 static PySequenceMethods __pyx_tp_as_sequence_array = {
40787  __pyx_array___len__, /*sq_length*/
40788  0, /*sq_concat*/
40789  0, /*sq_repeat*/
40790  __pyx_sq_item_array, /*sq_item*/
40791  0, /*sq_slice*/
40792  0, /*sq_ass_item*/
40793  0, /*sq_ass_slice*/
40794  0, /*sq_contains*/
40795  0, /*sq_inplace_concat*/
40796  0, /*sq_inplace_repeat*/
40797 };
40798 
40799 static PyMappingMethods __pyx_tp_as_mapping_array = {
40800  __pyx_array___len__, /*mp_length*/
40801  __pyx_array___getitem__, /*mp_subscript*/
40802  __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
40803 };
40804 
40805 static PyBufferProcs __pyx_tp_as_buffer_array = {
40806  #if PY_MAJOR_VERSION < 3
40807  0, /*bf_getreadbuffer*/
40808  #endif
40809  #if PY_MAJOR_VERSION < 3
40810  0, /*bf_getwritebuffer*/
40811  #endif
40812  #if PY_MAJOR_VERSION < 3
40813  0, /*bf_getsegcount*/
40814  #endif
40815  #if PY_MAJOR_VERSION < 3
40816  0, /*bf_getcharbuffer*/
40817  #endif
40818  __pyx_array_getbuffer, /*bf_getbuffer*/
40819  0, /*bf_releasebuffer*/
40820 };
40821 
40822 static PyTypeObject __pyx_type___pyx_array = {
40823  PyVarObject_HEAD_INIT(0, 0)
40824  "mprans.MeshSmoothing.array", /*tp_name*/
40825  sizeof(struct __pyx_array_obj), /*tp_basicsize*/
40826  0, /*tp_itemsize*/
40827  __pyx_tp_dealloc_array, /*tp_dealloc*/
40828  #if PY_VERSION_HEX < 0x030800b4
40829  0, /*tp_print*/
40830  #endif
40831  #if PY_VERSION_HEX >= 0x030800b4
40832  0, /*tp_vectorcall_offset*/
40833  #endif
40834  0, /*tp_getattr*/
40835  0, /*tp_setattr*/
40836  #if PY_MAJOR_VERSION < 3
40837  0, /*tp_compare*/
40838  #endif
40839  #if PY_MAJOR_VERSION >= 3
40840  0, /*tp_as_async*/
40841  #endif
40842  0, /*tp_repr*/
40843  0, /*tp_as_number*/
40844  &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
40845  &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
40846  0, /*tp_hash*/
40847  0, /*tp_call*/
40848  0, /*tp_str*/
40849  __pyx_tp_getattro_array, /*tp_getattro*/
40850  0, /*tp_setattro*/
40851  &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
40852  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
40853  0, /*tp_doc*/
40854  0, /*tp_traverse*/
40855  0, /*tp_clear*/
40856  0, /*tp_richcompare*/
40857  0, /*tp_weaklistoffset*/
40858  0, /*tp_iter*/
40859  0, /*tp_iternext*/
40860  __pyx_methods_array, /*tp_methods*/
40861  0, /*tp_members*/
40862  __pyx_getsets_array, /*tp_getset*/
40863  0, /*tp_base*/
40864  0, /*tp_dict*/
40865  0, /*tp_descr_get*/
40866  0, /*tp_descr_set*/
40867  0, /*tp_dictoffset*/
40868  0, /*tp_init*/
40869  0, /*tp_alloc*/
40870  __pyx_tp_new_array, /*tp_new*/
40871  0, /*tp_free*/
40872  0, /*tp_is_gc*/
40873  0, /*tp_bases*/
40874  0, /*tp_mro*/
40875  0, /*tp_cache*/
40876  0, /*tp_subclasses*/
40877  0, /*tp_weaklist*/
40878  0, /*tp_del*/
40879  0, /*tp_version_tag*/
40880  #if PY_VERSION_HEX >= 0x030400a1
40881  0, /*tp_finalize*/
40882  #endif
40883  #if PY_VERSION_HEX >= 0x030800b1
40884  0, /*tp_vectorcall*/
40885  #endif
40886  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
40887  0, /*tp_print*/
40888  #endif
40889 };
40890 
40891 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
40892  struct __pyx_MemviewEnum_obj *p;
40893  PyObject *o;
40894  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
40895  o = (*t->tp_alloc)(t, 0);
40896  } else {
40897  o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
40898  }
40899  if (unlikely(!o)) return 0;
40900  p = ((struct __pyx_MemviewEnum_obj *)o);
40901  p->name = Py_None; Py_INCREF(Py_None);
40902  return o;
40903 }
40904 
40905 static void __pyx_tp_dealloc_Enum(PyObject *o) {
40906  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
40907  #if CYTHON_USE_TP_FINALIZE
40908  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
40909  if (PyObject_CallFinalizerFromDealloc(o)) return;
40910  }
40911  #endif
40912  PyObject_GC_UnTrack(o);
40913  Py_CLEAR(p->name);
40914  (*Py_TYPE(o)->tp_free)(o);
40915 }
40916 
40917 static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
40918  int e;
40919  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
40920  if (p->name) {
40921  e = (*v)(p->name, a); if (e) return e;
40922  }
40923  return 0;
40924 }
40925 
40926 static int __pyx_tp_clear_Enum(PyObject *o) {
40927  PyObject* tmp;
40928  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
40929  tmp = ((PyObject*)p->name);
40930  p->name = Py_None; Py_INCREF(Py_None);
40931  Py_XDECREF(tmp);
40932  return 0;
40933 }
40934 
40935 static PyMethodDef __pyx_methods_Enum[] = {
40936  {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0},
40937  {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0},
40938  {0, 0, 0, 0}
40939 };
40940 
40941 static PyTypeObject __pyx_type___pyx_MemviewEnum = {
40942  PyVarObject_HEAD_INIT(0, 0)
40943  "mprans.MeshSmoothing.Enum", /*tp_name*/
40944  sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
40945  0, /*tp_itemsize*/
40946  __pyx_tp_dealloc_Enum, /*tp_dealloc*/
40947  #if PY_VERSION_HEX < 0x030800b4
40948  0, /*tp_print*/
40949  #endif
40950  #if PY_VERSION_HEX >= 0x030800b4
40951  0, /*tp_vectorcall_offset*/
40952  #endif
40953  0, /*tp_getattr*/
40954  0, /*tp_setattr*/
40955  #if PY_MAJOR_VERSION < 3
40956  0, /*tp_compare*/
40957  #endif
40958  #if PY_MAJOR_VERSION >= 3
40959  0, /*tp_as_async*/
40960  #endif
40961  __pyx_MemviewEnum___repr__, /*tp_repr*/
40962  0, /*tp_as_number*/
40963  0, /*tp_as_sequence*/
40964  0, /*tp_as_mapping*/
40965  0, /*tp_hash*/
40966  0, /*tp_call*/
40967  0, /*tp_str*/
40968  0, /*tp_getattro*/
40969  0, /*tp_setattro*/
40970  0, /*tp_as_buffer*/
40971  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
40972  0, /*tp_doc*/
40973  __pyx_tp_traverse_Enum, /*tp_traverse*/
40974  __pyx_tp_clear_Enum, /*tp_clear*/
40975  0, /*tp_richcompare*/
40976  0, /*tp_weaklistoffset*/
40977  0, /*tp_iter*/
40978  0, /*tp_iternext*/
40979  __pyx_methods_Enum, /*tp_methods*/
40980  0, /*tp_members*/
40981  0, /*tp_getset*/
40982  0, /*tp_base*/
40983  0, /*tp_dict*/
40984  0, /*tp_descr_get*/
40985  0, /*tp_descr_set*/
40986  0, /*tp_dictoffset*/
40987  __pyx_MemviewEnum___init__, /*tp_init*/
40988  0, /*tp_alloc*/
40989  __pyx_tp_new_Enum, /*tp_new*/
40990  0, /*tp_free*/
40991  0, /*tp_is_gc*/
40992  0, /*tp_bases*/
40993  0, /*tp_mro*/
40994  0, /*tp_cache*/
40995  0, /*tp_subclasses*/
40996  0, /*tp_weaklist*/
40997  0, /*tp_del*/
40998  0, /*tp_version_tag*/
40999  #if PY_VERSION_HEX >= 0x030400a1
41000  0, /*tp_finalize*/
41001  #endif
41002  #if PY_VERSION_HEX >= 0x030800b1
41003  0, /*tp_vectorcall*/
41004  #endif
41005  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
41006  0, /*tp_print*/
41007  #endif
41008 };
41009 static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
41010 
41011 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
41012  struct __pyx_memoryview_obj *p;
41013  PyObject *o;
41014  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
41015  o = (*t->tp_alloc)(t, 0);
41016  } else {
41017  o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
41018  }
41019  if (unlikely(!o)) return 0;
41020  p = ((struct __pyx_memoryview_obj *)o);
41021  p->__pyx_vtab = __pyx_vtabptr_memoryview;
41022  p->obj = Py_None; Py_INCREF(Py_None);
41023  p->_size = Py_None; Py_INCREF(Py_None);
41024  p->_array_interface = Py_None; Py_INCREF(Py_None);
41025  p->view.obj = NULL;
41026  if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad;
41027  return o;
41028  bad:
41029  Py_DECREF(o); o = 0;
41030  return NULL;
41031 }
41032 
41033 static void __pyx_tp_dealloc_memoryview(PyObject *o) {
41034  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
41035  #if CYTHON_USE_TP_FINALIZE
41036  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
41037  if (PyObject_CallFinalizerFromDealloc(o)) return;
41038  }
41039  #endif
41040  PyObject_GC_UnTrack(o);
41041  {
41042  PyObject *etype, *eval, *etb;
41043  PyErr_Fetch(&etype, &eval, &etb);
41044  ++Py_REFCNT(o);
41045  __pyx_memoryview___dealloc__(o);
41046  --Py_REFCNT(o);
41047  PyErr_Restore(etype, eval, etb);
41048  }
41049  Py_CLEAR(p->obj);
41050  Py_CLEAR(p->_size);
41051  Py_CLEAR(p->_array_interface);
41052  (*Py_TYPE(o)->tp_free)(o);
41053 }
41054 
41055 static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
41056  int e;
41057  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
41058  if (p->obj) {
41059  e = (*v)(p->obj, a); if (e) return e;
41060  }
41061  if (p->_size) {
41062  e = (*v)(p->_size, a); if (e) return e;
41063  }
41064  if (p->_array_interface) {
41065  e = (*v)(p->_array_interface, a); if (e) return e;
41066  }
41067  if (p->view.obj) {
41068  e = (*v)(p->view.obj, a); if (e) return e;
41069  }
41070  return 0;
41071 }
41072 
41073 static int __pyx_tp_clear_memoryview(PyObject *o) {
41074  PyObject* tmp;
41075  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
41076  tmp = ((PyObject*)p->obj);
41077  p->obj = Py_None; Py_INCREF(Py_None);
41078  Py_XDECREF(tmp);
41079  tmp = ((PyObject*)p->_size);
41080  p->_size = Py_None; Py_INCREF(Py_None);
41081  Py_XDECREF(tmp);
41082  tmp = ((PyObject*)p->_array_interface);
41083  p->_array_interface = Py_None; Py_INCREF(Py_None);
41084  Py_XDECREF(tmp);
41085  Py_CLEAR(p->view.obj);
41086  return 0;
41087 }
41088 static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
41089  PyObject *r;
41090  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
41091  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
41092  Py_DECREF(x);
41093  return r;
41094 }
41095 
41096 static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
41097  if (v) {
41098  return __pyx_memoryview___setitem__(o, i, v);
41099  }
41100  else {
41101  PyErr_Format(PyExc_NotImplementedError,
41102  "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
41103  return -1;
41104  }
41105 }
41106 
41107 static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
41108  return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
41109 }
41110 
41111 static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
41112  return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
41113 }
41114 
41115 static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
41116  return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
41117 }
41118 
41119 static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
41120  return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
41121 }
41122 
41123 static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
41124  return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
41125 }
41126 
41127 static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
41128  return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
41129 }
41130 
41131 static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
41132  return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
41133 }
41134 
41135 static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
41136  return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
41137 }
41138 
41139 static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
41140  return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
41141 }
41142 
41143 static PyMethodDef __pyx_methods_memoryview[] = {
41144  {"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0},
41145  {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0},
41146  {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0},
41147  {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0},
41148  {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0},
41149  {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0},
41150  {0, 0, 0, 0}
41151 };
41152 
41153 static struct PyGetSetDef __pyx_getsets_memoryview[] = {
41154  {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, (char *)0, 0},
41155  {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, (char *)0, 0},
41156  {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, (char *)0, 0},
41157  {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, (char *)0, 0},
41158  {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (char *)0, 0},
41159  {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (char *)0, 0},
41160  {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (char *)0, 0},
41161  {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (char *)0, 0},
41162  {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0},
41163  {0, 0, 0, 0, 0}
41164 };
41165 
41166 static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
41167  __pyx_memoryview___len__, /*sq_length*/
41168  0, /*sq_concat*/
41169  0, /*sq_repeat*/
41170  __pyx_sq_item_memoryview, /*sq_item*/
41171  0, /*sq_slice*/
41172  0, /*sq_ass_item*/
41173  0, /*sq_ass_slice*/
41174  0, /*sq_contains*/
41175  0, /*sq_inplace_concat*/
41176  0, /*sq_inplace_repeat*/
41177 };
41178 
41179 static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
41180  __pyx_memoryview___len__, /*mp_length*/
41181  __pyx_memoryview___getitem__, /*mp_subscript*/
41182  __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
41183 };
41184 
41185 static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
41186  #if PY_MAJOR_VERSION < 3
41187  0, /*bf_getreadbuffer*/
41188  #endif
41189  #if PY_MAJOR_VERSION < 3
41190  0, /*bf_getwritebuffer*/
41191  #endif
41192  #if PY_MAJOR_VERSION < 3
41193  0, /*bf_getsegcount*/
41194  #endif
41195  #if PY_MAJOR_VERSION < 3
41196  0, /*bf_getcharbuffer*/
41197  #endif
41198  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
41199  0, /*bf_releasebuffer*/
41200 };
41201 
41202 static PyTypeObject __pyx_type___pyx_memoryview = {
41203  PyVarObject_HEAD_INIT(0, 0)
41204  "mprans.MeshSmoothing.memoryview", /*tp_name*/
41205  sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
41206  0, /*tp_itemsize*/
41207  __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
41208  #if PY_VERSION_HEX < 0x030800b4
41209  0, /*tp_print*/
41210  #endif
41211  #if PY_VERSION_HEX >= 0x030800b4
41212  0, /*tp_vectorcall_offset*/
41213  #endif
41214  0, /*tp_getattr*/
41215  0, /*tp_setattr*/
41216  #if PY_MAJOR_VERSION < 3
41217  0, /*tp_compare*/
41218  #endif
41219  #if PY_MAJOR_VERSION >= 3
41220  0, /*tp_as_async*/
41221  #endif
41222  __pyx_memoryview___repr__, /*tp_repr*/
41223  0, /*tp_as_number*/
41224  &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
41225  &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
41226  0, /*tp_hash*/
41227  0, /*tp_call*/
41228  __pyx_memoryview___str__, /*tp_str*/
41229  0, /*tp_getattro*/
41230  0, /*tp_setattro*/
41231  &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
41232  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
41233  0, /*tp_doc*/
41234  __pyx_tp_traverse_memoryview, /*tp_traverse*/
41235  __pyx_tp_clear_memoryview, /*tp_clear*/
41236  0, /*tp_richcompare*/
41237  0, /*tp_weaklistoffset*/
41238  0, /*tp_iter*/
41239  0, /*tp_iternext*/
41240  __pyx_methods_memoryview, /*tp_methods*/
41241  0, /*tp_members*/
41242  __pyx_getsets_memoryview, /*tp_getset*/
41243  0, /*tp_base*/
41244  0, /*tp_dict*/
41245  0, /*tp_descr_get*/
41246  0, /*tp_descr_set*/
41247  0, /*tp_dictoffset*/
41248  0, /*tp_init*/
41249  0, /*tp_alloc*/
41250  __pyx_tp_new_memoryview, /*tp_new*/
41251  0, /*tp_free*/
41252  0, /*tp_is_gc*/
41253  0, /*tp_bases*/
41254  0, /*tp_mro*/
41255  0, /*tp_cache*/
41256  0, /*tp_subclasses*/
41257  0, /*tp_weaklist*/
41258  0, /*tp_del*/
41259  0, /*tp_version_tag*/
41260  #if PY_VERSION_HEX >= 0x030400a1
41261  0, /*tp_finalize*/
41262  #endif
41263  #if PY_VERSION_HEX >= 0x030800b1
41264  0, /*tp_vectorcall*/
41265  #endif
41266  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
41267  0, /*tp_print*/
41268  #endif
41269 };
41270 static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
41271 
41272 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
41273  struct __pyx_memoryviewslice_obj *p;
41274  PyObject *o = __pyx_tp_new_memoryview(t, a, k);
41275  if (unlikely(!o)) return 0;
41276  p = ((struct __pyx_memoryviewslice_obj *)o);
41277  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
41278  p->from_object = Py_None; Py_INCREF(Py_None);
41279  p->from_slice.memview = NULL;
41280  return o;
41281 }
41282 
41283 static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
41284  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
41285  #if CYTHON_USE_TP_FINALIZE
41286  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
41287  if (PyObject_CallFinalizerFromDealloc(o)) return;
41288  }
41289  #endif
41290  PyObject_GC_UnTrack(o);
41291  {
41292  PyObject *etype, *eval, *etb;
41293  PyErr_Fetch(&etype, &eval, &etb);
41294  ++Py_REFCNT(o);
41295  __pyx_memoryviewslice___dealloc__(o);
41296  --Py_REFCNT(o);
41297  PyErr_Restore(etype, eval, etb);
41298  }
41299  Py_CLEAR(p->from_object);
41300  PyObject_GC_Track(o);
41301  __pyx_tp_dealloc_memoryview(o);
41302 }
41303 
41304 static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) {
41305  int e;
41306  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
41307  e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e;
41308  if (p->from_object) {
41309  e = (*v)(p->from_object, a); if (e) return e;
41310  }
41311  return 0;
41312 }
41313 
41314 static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
41315  PyObject* tmp;
41316  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
41317  __pyx_tp_clear_memoryview(o);
41318  tmp = ((PyObject*)p->from_object);
41319  p->from_object = Py_None; Py_INCREF(Py_None);
41320  Py_XDECREF(tmp);
41321  __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
41322  return 0;
41323 }
41324 
41325 static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) {
41326  return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o);
41327 }
41328 
41329 static PyMethodDef __pyx_methods__memoryviewslice[] = {
41330  {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0},
41331  {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0},
41332  {0, 0, 0, 0}
41333 };
41334 
41335 static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
41336  {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (char *)0, 0},
41337  {0, 0, 0, 0, 0}
41338 };
41339 
41340 static PyTypeObject __pyx_type___pyx_memoryviewslice = {
41341  PyVarObject_HEAD_INIT(0, 0)
41342  "mprans.MeshSmoothing._memoryviewslice", /*tp_name*/
41343  sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/
41344  0, /*tp_itemsize*/
41345  __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/
41346  #if PY_VERSION_HEX < 0x030800b4
41347  0, /*tp_print*/
41348  #endif
41349  #if PY_VERSION_HEX >= 0x030800b4
41350  0, /*tp_vectorcall_offset*/
41351  #endif
41352  0, /*tp_getattr*/
41353  0, /*tp_setattr*/
41354  #if PY_MAJOR_VERSION < 3
41355  0, /*tp_compare*/
41356  #endif
41357  #if PY_MAJOR_VERSION >= 3
41358  0, /*tp_as_async*/
41359  #endif
41360  #if CYTHON_COMPILING_IN_PYPY
41361  __pyx_memoryview___repr__, /*tp_repr*/
41362  #else
41363  0, /*tp_repr*/
41364  #endif
41365  0, /*tp_as_number*/
41366  0, /*tp_as_sequence*/
41367  0, /*tp_as_mapping*/
41368  0, /*tp_hash*/
41369  0, /*tp_call*/
41370  #if CYTHON_COMPILING_IN_PYPY
41371  __pyx_memoryview___str__, /*tp_str*/
41372  #else
41373  0, /*tp_str*/
41374  #endif
41375  0, /*tp_getattro*/
41376  0, /*tp_setattro*/
41377  0, /*tp_as_buffer*/
41378  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
41379  "Internal class for passing memoryview slices to Python", /*tp_doc*/
41380  __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
41381  __pyx_tp_clear__memoryviewslice, /*tp_clear*/
41382  0, /*tp_richcompare*/
41383  0, /*tp_weaklistoffset*/
41384  0, /*tp_iter*/
41385  0, /*tp_iternext*/
41386  __pyx_methods__memoryviewslice, /*tp_methods*/
41387  0, /*tp_members*/
41388  __pyx_getsets__memoryviewslice, /*tp_getset*/
41389  0, /*tp_base*/
41390  0, /*tp_dict*/
41391  0, /*tp_descr_get*/
41392  0, /*tp_descr_set*/
41393  0, /*tp_dictoffset*/
41394  0, /*tp_init*/
41395  0, /*tp_alloc*/
41396  __pyx_tp_new__memoryviewslice, /*tp_new*/
41397  0, /*tp_free*/
41398  0, /*tp_is_gc*/
41399  0, /*tp_bases*/
41400  0, /*tp_mro*/
41401  0, /*tp_cache*/
41402  0, /*tp_subclasses*/
41403  0, /*tp_weaklist*/
41404  0, /*tp_del*/
41405  0, /*tp_version_tag*/
41406  #if PY_VERSION_HEX >= 0x030400a1
41407  0, /*tp_finalize*/
41408  #endif
41409  #if PY_VERSION_HEX >= 0x030800b1
41410  0, /*tp_vectorcall*/
41411  #endif
41412  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
41413  0, /*tp_print*/
41414  #endif
41415 };
41416 
41417 static PyMethodDef __pyx_methods[] = {
41418  {0, 0, 0, 0}
41419 };
41420 
41421 #if PY_MAJOR_VERSION >= 3
41422 #if CYTHON_PEP489_MULTI_PHASE_INIT
41423 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
41424 static int __pyx_pymod_exec_MeshSmoothing(PyObject* module); /*proto*/
41425 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
41426  {Py_mod_create, (void*)__pyx_pymod_create},
41427  {Py_mod_exec, (void*)__pyx_pymod_exec_MeshSmoothing},
41428  {0, NULL}
41429 };
41430 #endif
41431 
41432 static struct PyModuleDef __pyx_moduledef = {
41433  PyModuleDef_HEAD_INIT,
41434  "MeshSmoothing",
41435  0, /* m_doc */
41436  #if CYTHON_PEP489_MULTI_PHASE_INIT
41437  0, /* m_size */
41438  #else
41439  -1, /* m_size */
41440  #endif
41441  __pyx_methods /* m_methods */,
41442  #if CYTHON_PEP489_MULTI_PHASE_INIT
41443  __pyx_moduledef_slots, /* m_slots */
41444  #else
41445  NULL, /* m_reload */
41446  #endif
41447  NULL, /* m_traverse */
41448  NULL, /* m_clear */
41449  NULL /* m_free */
41450 };
41451 #endif
41452 #ifndef CYTHON_SMALL_CODE
41453 #if defined(__clang__)
41454  #define CYTHON_SMALL_CODE
41455 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
41456  #define CYTHON_SMALL_CODE __attribute__((cold))
41457 #else
41458  #define CYTHON_SMALL_CODE
41459 #endif
41460 #endif
41461 
41462 static __Pyx_StringTabEntry __pyx_string_tab[] = {
41463  {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1},
41464  {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri, sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0},
41465  {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is, sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0},
41466  {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor, sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0},
41467  {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi, sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0},
41468  {&__pyx_kp_s_Cannot_index_with_type_s, __pyx_k_Cannot_index_with_type_s, sizeof(__pyx_k_Cannot_index_with_type_s), 0, 0, 1, 0},
41469  {&__pyx_n_s_Comm, __pyx_k_Comm, sizeof(__pyx_k_Comm), 0, 0, 1, 1},
41470  {&__pyx_n_s_Commit, __pyx_k_Commit, sizeof(__pyx_k_Commit), 0, 0, 1, 1},
41471  {&__pyx_n_s_Create_contiguous, __pyx_k_Create_contiguous, sizeof(__pyx_k_Create_contiguous), 0, 0, 1, 1},
41472  {&__pyx_n_s_DOUBLE, __pyx_k_DOUBLE, sizeof(__pyx_k_DOUBLE), 0, 0, 1, 1},
41473  {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
41474  {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr, sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0},
41475  {&__pyx_kp_u_Format_string_allocated_too_shor, __pyx_k_Format_string_allocated_too_shor, sizeof(__pyx_k_Format_string_allocated_too_shor), 0, 1, 0, 0},
41476  {&__pyx_kp_u_Format_string_allocated_too_shor_2, __pyx_k_Format_string_allocated_too_shor_2, sizeof(__pyx_k_Format_string_allocated_too_shor_2), 0, 1, 0, 0},
41477  {&__pyx_n_s_Gatherv, __pyx_k_Gatherv, sizeof(__pyx_k_Gatherv), 0, 0, 1, 1},
41478  {&__pyx_n_s_IMRElementsArray, __pyx_k_IMRElementsArray, sizeof(__pyx_k_IMRElementsArray), 0, 0, 1, 1},
41479  {&__pyx_n_s_IMRNodesArray, __pyx_k_IMRNodesArray, sizeof(__pyx_k_IMRNodesArray), 0, 0, 1, 1},
41480  {&__pyx_n_s_INT, __pyx_k_INT, sizeof(__pyx_k_INT), 0, 0, 1, 1},
41481  {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
41482  {&__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_k_Incompatible_checksums_s_vs_0xb0, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xb0), 0, 0, 1, 0},
41483  {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
41484  {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0},
41485  {&__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 0, 1, 0},
41486  {&__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_k_Invalid_shape_in_axis_d_d, sizeof(__pyx_k_Invalid_shape_in_axis_d_d), 0, 0, 1, 0},
41487  {&__pyx_n_s_J_array, __pyx_k_J_array, sizeof(__pyx_k_J_array), 0, 0, 1, 1},
41488  {&__pyx_n_s_MPI, __pyx_k_MPI, sizeof(__pyx_k_MPI), 0, 0, 1, 1},
41489  {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
41490  {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x, sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0},
41491  {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0},
41492  {&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor, sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0},
41493  {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1},
41494  {&__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a, sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 0, 1, 0},
41495  {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
41496  {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
41497  {&__pyx_n_s_SUM, __pyx_k_SUM, sizeof(__pyx_k_SUM), 0, 0, 1, 1},
41498  {&__pyx_kp_b_T, __pyx_k_T, sizeof(__pyx_k_T), 0, 0, 0, 0},
41499  {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
41500  {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0},
41501  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
41502  {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1},
41503  {&__pyx_kp_b__31, __pyx_k__31, sizeof(__pyx_k__31), 0, 0, 0, 0},
41504  {&__pyx_kp_b__32, __pyx_k__32, sizeof(__pyx_k__32), 0, 0, 0, 0},
41505  {&__pyx_kp_b__33, __pyx_k__33, sizeof(__pyx_k__33), 0, 0, 0, 0},
41506  {&__pyx_kp_b__34, __pyx_k__34, sizeof(__pyx_k__34), 0, 0, 0, 0},
41507  {&__pyx_kp_u__35, __pyx_k__35, sizeof(__pyx_k__35), 0, 1, 0, 0},
41508  {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1},
41509  {&__pyx_n_s_allreduce, __pyx_k_allreduce, sizeof(__pyx_k_allreduce), 0, 0, 1, 1},
41510  {&__pyx_n_s_alpha, __pyx_k_alpha, sizeof(__pyx_k_alpha), 0, 0, 1, 1},
41511  {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
41512  {&__pyx_n_s_apply_directly, __pyx_k_apply_directly, sizeof(__pyx_k_apply_directly), 0, 0, 1, 1},
41513  {&__pyx_n_s_arg_2doArray, __pyx_k_arg_2doArray, sizeof(__pyx_k_arg_2doArray), 0, 0, 1, 1},
41514  {&__pyx_n_s_arg_2rank, __pyx_k_arg_2rank, sizeof(__pyx_k_arg_2rank), 0, 0, 1, 1},
41515  {&__pyx_n_s_arg_2rank_values, __pyx_k_arg_2rank_values, sizeof(__pyx_k_arg_2rank_values), 0, 0, 1, 1},
41516  {&__pyx_n_s_arg_shape, __pyx_k_arg_shape, sizeof(__pyx_k_arg_shape), 0, 0, 1, 1},
41517  {&__pyx_n_s_arg_shape_copy, __pyx_k_arg_shape_copy, sizeof(__pyx_k_arg_shape_copy), 0, 0, 1, 1},
41518  {&__pyx_n_s_arg_shape_len, __pyx_k_arg_shape_len, sizeof(__pyx_k_arg_shape_len), 0, 0, 1, 1},
41519  {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
41520  {&__pyx_n_s_args_2, __pyx_k_args_2, sizeof(__pyx_k_args_2), 0, 0, 1, 1},
41521  {&__pyx_n_s_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1},
41522  {&__pyx_n_s_array_size, __pyx_k_array_size, sizeof(__pyx_k_array_size), 0, 0, 1, 1},
41523  {&__pyx_n_s_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 0, 0, 1, 1},
41524  {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1},
41525  {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
41526  {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1},
41527  {&__pyx_n_s_checkOwnedVariable, __pyx_k_checkOwnedVariable, sizeof(__pyx_k_checkOwnedVariable), 0, 0, 1, 1},
41528  {&__pyx_n_s_checkedElements, __pyx_k_checkedElements, sizeof(__pyx_k_checkedElements), 0, 0, 1, 1},
41529  {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
41530  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
41531  {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
41532  {&__pyx_n_s_comm, __pyx_k_comm, sizeof(__pyx_k_comm), 0, 0, 1, 1},
41533  {&__pyx_n_s_comm_size, __pyx_k_comm_size, sizeof(__pyx_k_comm_size), 0, 0, 1, 1},
41534  {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0},
41535  {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0},
41536  {&__pyx_n_s_coords, __pyx_k_coords, sizeof(__pyx_k_coords), 0, 0, 1, 1},
41537  {&__pyx_kp_s_could_not_find_element_element_e, __pyx_k_could_not_find_element_element_e, sizeof(__pyx_k_could_not_find_element_element_e), 0, 0, 1, 0},
41538  {&__pyx_n_s_counts_in, __pyx_k_counts_in, sizeof(__pyx_k_counts_in), 0, 0, 1, 1},
41539  {&__pyx_n_s_counts_out, __pyx_k_counts_out, sizeof(__pyx_k_counts_out), 0, 0, 1, 1},
41540  {&__pyx_n_s_datatype, __pyx_k_datatype, sizeof(__pyx_k_datatype), 0, 0, 1, 1},
41541  {&__pyx_n_s_detJ_array, __pyx_k_detJ_array, sizeof(__pyx_k_detJ_array), 0, 0, 1, 1},
41542  {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
41543  {&__pyx_n_s_dilation, __pyx_k_dilation, sizeof(__pyx_k_dilation), 0, 0, 1, 1},
41544  {&__pyx_n_s_disp, __pyx_k_disp, sizeof(__pyx_k_disp), 0, 0, 1, 1},
41545  {&__pyx_n_s_displacements_in, __pyx_k_displacements_in, sizeof(__pyx_k_displacements_in), 0, 0, 1, 1},
41546  {&__pyx_n_s_displacements_out, __pyx_k_displacements_out, sizeof(__pyx_k_displacements_out), 0, 0, 1, 1},
41547  {&__pyx_n_s_distortion, __pyx_k_distortion, sizeof(__pyx_k_distortion), 0, 0, 1, 1},
41548  {&__pyx_n_s_dot, __pyx_k_dot, sizeof(__pyx_k_dot), 0, 0, 1, 1},
41549  {&__pyx_n_s_double, __pyx_k_double, sizeof(__pyx_k_double), 0, 0, 1, 1},
41550  {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
41551  {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1},
41552  {&__pyx_n_s_eN, __pyx_k_eN, sizeof(__pyx_k_eN), 0, 0, 1, 1},
41553  {&__pyx_n_s_eOffset, __pyx_k_eOffset, sizeof(__pyx_k_eOffset), 0, 0, 1, 1},
41554  {&__pyx_n_s_el_average, __pyx_k_el_average, sizeof(__pyx_k_el_average), 0, 0, 1, 1},
41555  {&__pyx_n_s_elementBarycentersArray, __pyx_k_elementBarycentersArray, sizeof(__pyx_k_elementBarycentersArray), 0, 0, 1, 1},
41556  {&__pyx_n_s_elementBarycentersArray_2, __pyx_k_elementBarycentersArray_2, sizeof(__pyx_k_elementBarycentersArray_2), 0, 0, 1, 1},
41557  {&__pyx_n_s_elementBoundariesArray, __pyx_k_elementBoundariesArray, sizeof(__pyx_k_elementBoundariesArray), 0, 0, 1, 1},
41558  {&__pyx_n_s_elementBoundaryBarycentersArray, __pyx_k_elementBoundaryBarycentersArray, sizeof(__pyx_k_elementBoundaryBarycentersArray), 0, 0, 1, 1},
41559  {&__pyx_n_s_elementBoundaryElementsArray, __pyx_k_elementBoundaryElementsArray, sizeof(__pyx_k_elementBoundaryElementsArray), 0, 0, 1, 1},
41560  {&__pyx_n_s_elementBoundaryNodesArray, __pyx_k_elementBoundaryNodesArray, sizeof(__pyx_k_elementBoundaryNodesArray), 0, 0, 1, 1},
41561  {&__pyx_n_s_elementBoundaryNormalsArray, __pyx_k_elementBoundaryNormalsArray, sizeof(__pyx_k_elementBoundaryNormalsArray), 0, 0, 1, 1},
41562  {&__pyx_n_s_elementBoundaryNormalsArray_2, __pyx_k_elementBoundaryNormalsArray_2, sizeof(__pyx_k_elementBoundaryNormalsArray_2), 0, 0, 1, 1},
41563  {&__pyx_n_s_elementDilationArray, __pyx_k_elementDilationArray, sizeof(__pyx_k_elementDilationArray), 0, 0, 1, 1},
41564  {&__pyx_n_s_elementDistortionArray, __pyx_k_elementDistortionArray, sizeof(__pyx_k_elementDistortionArray), 0, 0, 1, 1},
41565  {&__pyx_n_s_elementMaps, __pyx_k_elementMaps, sizeof(__pyx_k_elementMaps), 0, 0, 1, 1},
41566  {&__pyx_n_s_elementNeighborsArray, __pyx_k_elementNeighborsArray, sizeof(__pyx_k_elementNeighborsArray), 0, 0, 1, 1},
41567  {&__pyx_n_s_elementNodesArray, __pyx_k_elementNodesArray, sizeof(__pyx_k_elementNodesArray), 0, 0, 1, 1},
41568  {&__pyx_n_s_elementVolumeArray, __pyx_k_elementVolumeArray, sizeof(__pyx_k_elementVolumeArray), 0, 0, 1, 1},
41569  {&__pyx_n_s_elementVolumeTargetArray, __pyx_k_elementVolumeTargetArray, sizeof(__pyx_k_elementVolumeTargetArray), 0, 0, 1, 1},
41570  {&__pyx_n_s_elementVolumesArray, __pyx_k_elementVolumesArray, sizeof(__pyx_k_elementVolumesArray), 0, 0, 1, 1},
41571  {&__pyx_n_s_elementVolumesArray_2, __pyx_k_elementVolumesArray_2, sizeof(__pyx_k_elementVolumesArray_2), 0, 0, 1, 1},
41572  {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
41573  {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
41574  {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
41575  {&__pyx_kp_s_error_looking_for_dir, __pyx_k_error_looking_for_dir, sizeof(__pyx_k_error_looking_for_dir), 0, 0, 1, 0},
41576  {&__pyx_n_s_exteriorElementBoundariesBoolArr, __pyx_k_exteriorElementBoundariesBoolArr, sizeof(__pyx_k_exteriorElementBoundariesBoolArr), 0, 0, 1, 1},
41577  {&__pyx_n_s_femSpace, __pyx_k_femSpace, sizeof(__pyx_k_femSpace), 0, 0, 1, 1},
41578  {&__pyx_n_s_fixedNodesBoolArray, __pyx_k_fixedNodesBoolArray, sizeof(__pyx_k_fixedNodesBoolArray), 0, 0, 1, 1},
41579  {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
41580  {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
41581  {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1},
41582  {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1},
41583  {&__pyx_n_s_genexpr, __pyx_k_genexpr, sizeof(__pyx_k_genexpr), 0, 0, 1, 1},
41584  {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
41585  {&__pyx_n_s_getCornerNodesTriangle, __pyx_k_getCornerNodesTriangle, sizeof(__pyx_k_getCornerNodesTriangle), 0, 0, 1, 1},
41586  {&__pyx_n_s_getDilationElements, __pyx_k_getDilationElements, sizeof(__pyx_k_getDilationElements), 0, 0, 1, 1},
41587  {&__pyx_n_s_getDistortionElements, __pyx_k_getDistortionElements, sizeof(__pyx_k_getDistortionElements), 0, 0, 1, 1},
41588  {&__pyx_n_s_getElementBoundaryNormalsTetra, __pyx_k_getElementBoundaryNormalsTetra, sizeof(__pyx_k_getElementBoundaryNormalsTetra), 0, 0, 1, 1},
41589  {&__pyx_n_s_getElementBoundaryNormalsTriangl, __pyx_k_getElementBoundaryNormalsTriangl, sizeof(__pyx_k_getElementBoundaryNormalsTriangl), 0, 0, 1, 1},
41590  {&__pyx_n_s_getElementVolumeTriangle, __pyx_k_getElementVolumeTriangle, sizeof(__pyx_k_getElementVolumeTriangle), 0, 0, 1, 1},
41591  {&__pyx_n_s_getInverseMeanRatioSingleTriangl, __pyx_k_getInverseMeanRatioSingleTriangl, sizeof(__pyx_k_getInverseMeanRatioSingleTriangl), 0, 0, 1, 1},
41592  {&__pyx_n_s_getInverseMeanRatioTriangleEleme, __pyx_k_getInverseMeanRatioTriangleEleme, sizeof(__pyx_k_getInverseMeanRatioTriangleEleme), 0, 0, 1, 1},
41593  {&__pyx_n_s_getInverseMeanRatioTriangleNodes, __pyx_k_getInverseMeanRatioTriangleNodes, sizeof(__pyx_k_getInverseMeanRatioTriangleNodes), 0, 0, 1, 1},
41594  {&__pyx_n_s_getInverseValue, __pyx_k_getInverseValue, sizeof(__pyx_k_getInverseValue), 0, 0, 1, 1},
41595  {&__pyx_n_s_getLocalElement, __pyx_k_getLocalElement, sizeof(__pyx_k_getLocalElement), 0, 0, 1, 1},
41596  {&__pyx_n_s_getLocalNearestElement, __pyx_k_getLocalNearestElement, sizeof(__pyx_k_getLocalNearestElement), 0, 0, 1, 1},
41597  {&__pyx_n_s_getLocalNearestElementAroundNode, __pyx_k_getLocalNearestElementAroundNode, sizeof(__pyx_k_getLocalNearestElementAroundNode), 0, 0, 1, 1},
41598  {&__pyx_n_s_getLocalNearestElementIntersecti, __pyx_k_getLocalNearestElementIntersecti, sizeof(__pyx_k_getLocalNearestElementIntersecti), 0, 0, 1, 1},
41599  {&__pyx_n_s_getLocalNearestNode, __pyx_k_getLocalNearestNode, sizeof(__pyx_k_getLocalNearestNode), 0, 0, 1, 1},
41600  {&__pyx_n_s_getNonOwnedNodeValues, __pyx_k_getNonOwnedNodeValues, sizeof(__pyx_k_getNonOwnedNodeValues), 0, 0, 1, 1},
41601  {&__pyx_n_s_getNonOwnedNodeValues_locals_gen, __pyx_k_getNonOwnedNodeValues_locals_gen, sizeof(__pyx_k_getNonOwnedNodeValues_locals_gen), 0, 0, 1, 1},
41602  {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
41603  {&__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 0, 1, 0},
41604  {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
41605  {&__pyx_n_s_iN, __pyx_k_iN, sizeof(__pyx_k_iN), 0, 0, 1, 1},
41606  {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
41607  {&__pyx_n_s_ii, __pyx_k_ii, sizeof(__pyx_k_ii), 0, 0, 1, 1},
41608  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
41609  {&__pyx_n_s_int32, __pyx_k_int32, sizeof(__pyx_k_int32), 0, 0, 1, 1},
41610  {&__pyx_n_s_inv, __pyx_k_inv, sizeof(__pyx_k_inv), 0, 0, 1, 1},
41611  {&__pyx_n_s_ir, __pyx_k_ir, sizeof(__pyx_k_ir), 0, 0, 1, 1},
41612  {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
41613  {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0},
41614  {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1},
41615  {&__pyx_n_s_linalg, __pyx_k_linalg, sizeof(__pyx_k_linalg), 0, 0, 1, 1},
41616  {&__pyx_n_s_logEvent, __pyx_k_logEvent, sizeof(__pyx_k_logEvent), 0, 0, 1, 1},
41617  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
41618  {&__pyx_n_s_maxit, __pyx_k_maxit, sizeof(__pyx_k_maxit), 0, 0, 1, 1},
41619  {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1},
41620  {&__pyx_n_s_mesh, __pyx_k_mesh, sizeof(__pyx_k_mesh), 0, 0, 1, 1},
41621  {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
41622  {&__pyx_n_s_mpi4py, __pyx_k_mpi4py, sizeof(__pyx_k_mpi4py), 0, 0, 1, 1},
41623  {&__pyx_n_s_mprans_MeshSmoothing, __pyx_k_mprans_MeshSmoothing, sizeof(__pyx_k_mprans_MeshSmoothing), 0, 0, 1, 1},
41624  {&__pyx_n_s_my_rank, __pyx_k_my_rank, sizeof(__pyx_k_my_rank), 0, 0, 1, 1},
41625  {&__pyx_n_s_my_size, __pyx_k_my_size, sizeof(__pyx_k_my_size), 0, 0, 1, 1},
41626  {&__pyx_n_s_nA, __pyx_k_nA, sizeof(__pyx_k_nA), 0, 0, 1, 1},
41627  {&__pyx_n_s_nB, __pyx_k_nB, sizeof(__pyx_k_nB), 0, 0, 1, 1},
41628  {&__pyx_n_s_nC, __pyx_k_nC, sizeof(__pyx_k_nC), 0, 0, 1, 1},
41629  {&__pyx_n_s_nElements, __pyx_k_nElements, sizeof(__pyx_k_nElements), 0, 0, 1, 1},
41630  {&__pyx_n_s_nNodes, __pyx_k_nNodes, sizeof(__pyx_k_nNodes), 0, 0, 1, 1},
41631  {&__pyx_n_s_nNodes_global, __pyx_k_nNodes_global, sizeof(__pyx_k_nNodes_global), 0, 0, 1, 1},
41632  {&__pyx_n_s_nNodes_owned, __pyx_k_nNodes_owned, sizeof(__pyx_k_nNodes_owned), 0, 0, 1, 1},
41633  {&__pyx_n_s_nVariables_owned, __pyx_k_nVariables_owned, sizeof(__pyx_k_nVariables_owned), 0, 0, 1, 1},
41634  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
41635  {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
41636  {&__pyx_n_s_nd, __pyx_k_nd, sizeof(__pyx_k_nd), 0, 0, 1, 1},
41637  {&__pyx_kp_u_ndarray_is_not_C_contiguous, __pyx_k_ndarray_is_not_C_contiguous, sizeof(__pyx_k_ndarray_is_not_C_contiguous), 0, 1, 0, 0},
41638  {&__pyx_kp_u_ndarray_is_not_Fortran_contiguou, __pyx_k_ndarray_is_not_Fortran_contiguou, sizeof(__pyx_k_ndarray_is_not_Fortran_contiguou), 0, 1, 0, 0},
41639  {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1},
41640  {&__pyx_n_s_nearest_eN, __pyx_k_nearest_eN, sizeof(__pyx_k_nearest_eN), 0, 0, 1, 1},
41641  {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
41642  {&__pyx_n_s_new_rank, __pyx_k_new_rank, sizeof(__pyx_k_new_rank), 0, 0, 1, 1},
41643  {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
41644  {&__pyx_n_s_node, __pyx_k_node, sizeof(__pyx_k_node), 0, 0, 1, 1},
41645  {&__pyx_n_s_node0, __pyx_k_node0, sizeof(__pyx_k_node0), 0, 0, 1, 1},
41646  {&__pyx_n_s_nodeArray, __pyx_k_nodeArray, sizeof(__pyx_k_nodeArray), 0, 0, 1, 1},
41647  {&__pyx_n_s_nodeArray_2, __pyx_k_nodeArray_2, sizeof(__pyx_k_nodeArray_2), 0, 0, 1, 1},
41648  {&__pyx_n_s_nodeElementOffsets, __pyx_k_nodeElementOffsets, sizeof(__pyx_k_nodeElementOffsets), 0, 0, 1, 1},
41649  {&__pyx_n_s_nodeElementsArray, __pyx_k_nodeElementsArray, sizeof(__pyx_k_nodeElementsArray), 0, 0, 1, 1},
41650  {&__pyx_n_s_nodeMaterialTypes, __pyx_k_nodeMaterialTypes, sizeof(__pyx_k_nodeMaterialTypes), 0, 0, 1, 1},
41651  {&__pyx_n_s_nodeNumbering_subdomain2global, __pyx_k_nodeNumbering_subdomain2global, sizeof(__pyx_k_nodeNumbering_subdomain2global), 0, 0, 1, 1},
41652  {&__pyx_n_s_nodeOffsets_subdomain_owned, __pyx_k_nodeOffsets_subdomain_owned, sizeof(__pyx_k_nodeOffsets_subdomain_owned), 0, 0, 1, 1},
41653  {&__pyx_n_s_nodeStarArray, __pyx_k_nodeStarArray, sizeof(__pyx_k_nodeStarArray), 0, 0, 1, 1},
41654  {&__pyx_n_s_nodeStarOffsets, __pyx_k_nodeStarOffsets, sizeof(__pyx_k_nodeStarOffsets), 0, 0, 1, 1},
41655  {&__pyx_n_s_node_new_rank, __pyx_k_node_new_rank, sizeof(__pyx_k_node_new_rank), 0, 0, 1, 1},
41656  {&__pyx_n_s_nodes_2doArray, __pyx_k_nodes_2doArray, sizeof(__pyx_k_nodes_2doArray), 0, 0, 1, 1},
41657  {&__pyx_n_s_nodes_2rank, __pyx_k_nodes_2rank, sizeof(__pyx_k_nodes_2rank), 0, 0, 1, 1},
41658  {&__pyx_n_s_nodes_2rank_len, __pyx_k_nodes_2rank_len, sizeof(__pyx_k_nodes_2rank_len), 0, 0, 1, 1},
41659  {&__pyx_n_s_nodes_2rank_values, __pyx_k_nodes_2rank_values, sizeof(__pyx_k_nodes_2rank_values), 0, 0, 1, 1},
41660  {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
41661  {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
41662  {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0},
41663  {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0},
41664  {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
41665  {&__pyx_n_s_onElement, __pyx_k_onElement, sizeof(__pyx_k_onElement), 0, 0, 1, 1},
41666  {&__pyx_n_s_op, __pyx_k_op, sizeof(__pyx_k_op), 0, 0, 1, 1},
41667  {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1},
41668  {&__pyx_n_s_patchBoundaryNodes, __pyx_k_patchBoundaryNodes, sizeof(__pyx_k_patchBoundaryNodes), 0, 0, 1, 1},
41669  {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
41670  {&__pyx_n_s_proteus, __pyx_k_proteus, sizeof(__pyx_k_proteus), 0, 0, 1, 1},
41671  {&__pyx_n_s_proteus_Profiling, __pyx_k_proteus_Profiling, sizeof(__pyx_k_proteus_Profiling), 0, 0, 1, 1},
41672  {&__pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_k_proteus_mprans_MeshSmoothing_pyx, sizeof(__pyx_k_proteus_mprans_MeshSmoothing_pyx), 0, 0, 1, 0},
41673  {&__pyx_n_s_pyScalarRecoveryAtNodes, __pyx_k_pyScalarRecoveryAtNodes, sizeof(__pyx_k_pyScalarRecoveryAtNodes), 0, 0, 1, 1},
41674  {&__pyx_n_s_pyScalarRecoveryAtNodesWeighted, __pyx_k_pyScalarRecoveryAtNodesWeighted, sizeof(__pyx_k_pyScalarRecoveryAtNodesWeighted), 0, 0, 1, 1},
41675  {&__pyx_n_s_pyVectorRecoveryAtNodes, __pyx_k_pyVectorRecoveryAtNodes, sizeof(__pyx_k_pyVectorRecoveryAtNodes), 0, 0, 1, 1},
41676  {&__pyx_n_s_pyVectorRecoveryAtNodesWeighted, __pyx_k_pyVectorRecoveryAtNodesWeighted, sizeof(__pyx_k_pyVectorRecoveryAtNodesWeighted), 0, 0, 1, 1},
41677  {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
41678  {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
41679  {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1},
41680  {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
41681  {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
41682  {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
41683  {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1},
41684  {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
41685  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
41686  {&__pyx_n_s_rank, __pyx_k_rank, sizeof(__pyx_k_rank), 0, 0, 1, 1},
41687  {&__pyx_n_s_rank_recv, __pyx_k_rank_recv, sizeof(__pyx_k_rank_recv), 0, 0, 1, 1},
41688  {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
41689  {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
41690  {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
41691  {&__pyx_n_s_referenceElement, __pyx_k_referenceElement, sizeof(__pyx_k_referenceElement), 0, 0, 1, 1},
41692  {&__pyx_n_s_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 0, 1, 1},
41693  {&__pyx_n_s_root, __pyx_k_root, sizeof(__pyx_k_root), 0, 0, 1, 1},
41694  {&__pyx_kp_u_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 1, 0, 0},
41695  {&__pyx_n_s_scalars, __pyx_k_scalars, sizeof(__pyx_k_scalars), 0, 0, 1, 1},
41696  {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
41697  {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
41698  {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
41699  {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
41700  {&__pyx_n_s_shape_factor, __pyx_k_shape_factor, sizeof(__pyx_k_shape_factor), 0, 0, 1, 1},
41701  {&__pyx_n_s_simultaneous, __pyx_k_simultaneous, sizeof(__pyx_k_simultaneous), 0, 0, 1, 1},
41702  {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
41703  {&__pyx_n_s_smoothBoundaries, __pyx_k_smoothBoundaries, sizeof(__pyx_k_smoothBoundaries), 0, 0, 1, 1},
41704  {&__pyx_n_s_smoothNodesCentroid, __pyx_k_smoothNodesCentroid, sizeof(__pyx_k_smoothNodesCentroid), 0, 0, 1, 1},
41705  {&__pyx_n_s_smoothNodesLaplace, __pyx_k_smoothNodesLaplace, sizeof(__pyx_k_smoothNodesLaplace), 0, 0, 1, 1},
41706  {&__pyx_n_s_smoothNodesQuality, __pyx_k_smoothNodesQuality, sizeof(__pyx_k_smoothNodesQuality), 0, 0, 1, 1},
41707  {&__pyx_kp_s_smoothNodesQuality_is_work_in_pr, __pyx_k_smoothNodesQuality_is_work_in_pr, sizeof(__pyx_k_smoothNodesQuality_is_work_in_pr), 0, 0, 1, 0},
41708  {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
41709  {&__pyx_n_s_starting_coords, __pyx_k_starting_coords, sizeof(__pyx_k_starting_coords), 0, 0, 1, 1},
41710  {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1},
41711  {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
41712  {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0},
41713  {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect, sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0},
41714  {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0},
41715  {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
41716  {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1},
41717  {&__pyx_n_s_sumtot, __pyx_k_sumtot, sizeof(__pyx_k_sumtot), 0, 0, 1, 1},
41718  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
41719  {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
41720  {&__pyx_n_s_tompi4py, __pyx_k_tompi4py, sizeof(__pyx_k_tompi4py), 0, 0, 1, 1},
41721  {&__pyx_n_s_transpose, __pyx_k_transpose, sizeof(__pyx_k_transpose), 0, 0, 1, 1},
41722  {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data, sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0},
41723  {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0},
41724  {&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0},
41725  {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1},
41726  {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
41727  {&__pyx_n_s_updateDilationElements, __pyx_k_updateDilationElements, sizeof(__pyx_k_updateDilationElements), 0, 0, 1, 1},
41728  {&__pyx_n_s_updateDistortionElements, __pyx_k_updateDistortionElements, sizeof(__pyx_k_updateDistortionElements), 0, 0, 1, 1},
41729  {&__pyx_n_s_updateElementBarycenters, __pyx_k_updateElementBarycenters, sizeof(__pyx_k_updateElementBarycenters), 0, 0, 1, 1},
41730  {&__pyx_n_s_updateElementBoundaryNormalsTetr, __pyx_k_updateElementBoundaryNormalsTetr, sizeof(__pyx_k_updateElementBoundaryNormalsTetr), 0, 0, 1, 1},
41731  {&__pyx_n_s_updateElementBoundaryNormalsTria, __pyx_k_updateElementBoundaryNormalsTria, sizeof(__pyx_k_updateElementBoundaryNormalsTria), 0, 0, 1, 1},
41732  {&__pyx_n_s_updateElementVolumesTetra, __pyx_k_updateElementVolumesTetra, sizeof(__pyx_k_updateElementVolumesTetra), 0, 0, 1, 1},
41733  {&__pyx_n_s_updateElementVolumesTriangle, __pyx_k_updateElementVolumesTriangle, sizeof(__pyx_k_updateElementVolumesTriangle), 0, 0, 1, 1},
41734  {&__pyx_n_s_updateInverseMeanRatioTriangleEl, __pyx_k_updateInverseMeanRatioTriangleEl, sizeof(__pyx_k_updateInverseMeanRatioTriangleEl), 0, 0, 1, 1},
41735  {&__pyx_n_s_updateInverseMeanRatioTriangleNo, __pyx_k_updateInverseMeanRatioTriangleNo, sizeof(__pyx_k_updateInverseMeanRatioTriangleNo), 0, 0, 1, 1},
41736  {&__pyx_n_s_variableNumbering_subdomain2glob, __pyx_k_variableNumbering_subdomain2glob, sizeof(__pyx_k_variableNumbering_subdomain2glob), 0, 0, 1, 1},
41737  {&__pyx_n_s_variableOffsets_subdomain_owned, __pyx_k_variableOffsets_subdomain_owned, sizeof(__pyx_k_variableOffsets_subdomain_owned), 0, 0, 1, 1},
41738  {&__pyx_n_s_variable_nb_local, __pyx_k_variable_nb_local, sizeof(__pyx_k_variable_nb_local), 0, 0, 1, 1},
41739  {&__pyx_n_s_vectors, __pyx_k_vectors, sizeof(__pyx_k_vectors), 0, 0, 1, 1},
41740  {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
41741  {&__pyx_n_s_x2, __pyx_k_x2, sizeof(__pyx_k_x2), 0, 0, 1, 1},
41742  {&__pyx_n_s_xi, __pyx_k_xi, sizeof(__pyx_k_xi), 0, 0, 1, 1},
41743  {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1},
41744  {&__pyx_n_s_y2, __pyx_k_y2, sizeof(__pyx_k_y2), 0, 0, 1, 1},
41745  {&__pyx_n_s_z, __pyx_k_z, sizeof(__pyx_k_z), 0, 0, 1, 1},
41746  {&__pyx_n_s_z2, __pyx_k_z2, sizeof(__pyx_k_z2), 0, 0, 1, 1},
41747  {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
41748  {&__pyx_n_s_zeros_like, __pyx_k_zeros_like, sizeof(__pyx_k_zeros_like), 0, 0, 1, 1},
41749  {0, 0, 0, 0, 0, 0, 0}
41750 };
41751 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
41752  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 414, __pyx_L1_error)
41753  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 1041, __pyx_L1_error)
41754  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 272, __pyx_L1_error)
41755  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 856, __pyx_L1_error)
41756  __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 1038, __pyx_L1_error)
41757  __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 148, __pyx_L1_error)
41758  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(2, 2, __pyx_L1_error)
41759  __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(2, 404, __pyx_L1_error)
41760  __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(2, 613, __pyx_L1_error)
41761  __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(2, 832, __pyx_L1_error)
41762  return 0;
41763  __pyx_L1_error:;
41764  return -1;
41765 }
41766 
41767 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
41768  __Pyx_RefNannyDeclarations
41769  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
41770 
41771  /* "mprans/MeshSmoothing.pyx":588
41772  * cdef int sumtot
41773  * cdef int[:] nodes_2rank_values
41774  * cdef int[:] nodes_2doArray = np.zeros(0, dtype=np.int32) # <<<<<<<<<<<<<<
41775  * if arg_shape_len > 1:
41776  * for i in range(1, arg_shape_len):
41777  */
41778  __pyx_tuple__3 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 588, __pyx_L1_error)
41779  __Pyx_GOTREF(__pyx_tuple__3);
41780  __Pyx_GIVEREF(__pyx_tuple__3);
41781 
41782  /* "mprans/MeshSmoothing.pyx":608
41783  * # -----
41784  * # find length of array to do on processor rank_recv
41785  * nodes_2rank_values = (nodes_2rank[rank_recv][:]).astype(np.int32) # <<<<<<<<<<<<<<
41786  * nodes_2rank_len = len(nodes_2rank_values)
41787  * array_size = comm.allreduce(nodes_2rank_len, op=MPI.SUM)
41788  */
41789  __pyx_slice__4 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__4)) __PYX_ERR(0, 608, __pyx_L1_error)
41790  __Pyx_GOTREF(__pyx_slice__4);
41791  __Pyx_GIVEREF(__pyx_slice__4);
41792 
41793  /* "mprans/MeshSmoothing.pyx":977
41794  * cdef double[:,:] W = np.array([[1., 0.5],
41795  * [0., sqrt(3)/2.]])
41796  * cdef double[:,:] A = np.zeros((2,2)) # <<<<<<<<<<<<<<
41797  * cdef double[:,:] AW = np.zeros((2,2))
41798  * cdef int[:] nElementsArray = np.zeros(nElements)
41799  */
41800  __pyx_tuple__6 = PyTuple_Pack(2, __pyx_int_2, __pyx_int_2); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 977, __pyx_L1_error)
41801  __Pyx_GOTREF(__pyx_tuple__6);
41802  __Pyx_GIVEREF(__pyx_tuple__6);
41803 
41804  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":272
41805  * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
41806  * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
41807  * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
41808  *
41809  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
41810  */
41811  __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 272, __pyx_L1_error)
41812  __Pyx_GOTREF(__pyx_tuple__7);
41813  __Pyx_GIVEREF(__pyx_tuple__7);
41814 
41815  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":276
41816  * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
41817  * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
41818  * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
41819  *
41820  * info.buf = PyArray_DATA(self)
41821  */
41822  __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 276, __pyx_L1_error)
41823  __Pyx_GOTREF(__pyx_tuple__8);
41824  __Pyx_GIVEREF(__pyx_tuple__8);
41825 
41826  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":306
41827  * if ((descr.byteorder == c'>' and little_endian) or
41828  * (descr.byteorder == c'<' and not little_endian)):
41829  * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
41830  * if t == NPY_BYTE: f = "b"
41831  * elif t == NPY_UBYTE: f = "B"
41832  */
41833  __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 306, __pyx_L1_error)
41834  __Pyx_GOTREF(__pyx_tuple__9);
41835  __Pyx_GIVEREF(__pyx_tuple__9);
41836 
41837  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":856
41838  *
41839  * if (end - f) - <int>(new_offset - offset[0]) < 15:
41840  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
41841  *
41842  * if ((child.byteorder == c'>' and little_endian) or
41843  */
41844  __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 856, __pyx_L1_error)
41845  __Pyx_GOTREF(__pyx_tuple__10);
41846  __Pyx_GIVEREF(__pyx_tuple__10);
41847 
41848  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":880
41849  * t = child.type_num
41850  * if end - f < 5:
41851  * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
41852  *
41853  * # Until ticket #99 is fixed, use integers to avoid warnings
41854  */
41855  __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 880, __pyx_L1_error)
41856  __Pyx_GOTREF(__pyx_tuple__11);
41857  __Pyx_GIVEREF(__pyx_tuple__11);
41858 
41859  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1038
41860  * _import_array()
41861  * except Exception:
41862  * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
41863  *
41864  * cdef inline int import_umath() except -1:
41865  */
41866  __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 1038, __pyx_L1_error)
41867  __Pyx_GOTREF(__pyx_tuple__12);
41868  __Pyx_GIVEREF(__pyx_tuple__12);
41869 
41870  /* "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd":1044
41871  * _import_umath()
41872  * except Exception:
41873  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
41874  *
41875  * cdef inline int import_ufunc() except -1:
41876  */
41877  __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 1044, __pyx_L1_error)
41878  __Pyx_GOTREF(__pyx_tuple__13);
41879  __Pyx_GIVEREF(__pyx_tuple__13);
41880 
41881  /* "View.MemoryView":133
41882  *
41883  * if not self.ndim:
41884  * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<<
41885  *
41886  * if itemsize <= 0:
41887  */
41888  __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(2, 133, __pyx_L1_error)
41889  __Pyx_GOTREF(__pyx_tuple__14);
41890  __Pyx_GIVEREF(__pyx_tuple__14);
41891 
41892  /* "View.MemoryView":136
41893  *
41894  * if itemsize <= 0:
41895  * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<<
41896  *
41897  * if not isinstance(format, bytes):
41898  */
41899  __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(2, 136, __pyx_L1_error)
41900  __Pyx_GOTREF(__pyx_tuple__15);
41901  __Pyx_GIVEREF(__pyx_tuple__15);
41902 
41903  /* "View.MemoryView":148
41904  *
41905  * if not self._shape:
41906  * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<<
41907  *
41908  *
41909  */
41910  __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(2, 148, __pyx_L1_error)
41911  __Pyx_GOTREF(__pyx_tuple__16);
41912  __Pyx_GIVEREF(__pyx_tuple__16);
41913 
41914  /* "View.MemoryView":176
41915  * self.data = <char *>malloc(self.len)
41916  * if not self.data:
41917  * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<<
41918  *
41919  * if self.dtype_is_object:
41920  */
41921  __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(2, 176, __pyx_L1_error)
41922  __Pyx_GOTREF(__pyx_tuple__17);
41923  __Pyx_GIVEREF(__pyx_tuple__17);
41924 
41925  /* "View.MemoryView":192
41926  * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
41927  * if not (flags & bufmode):
41928  * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<<
41929  * info.buf = self.data
41930  * info.len = self.len
41931  */
41932  __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(2, 192, __pyx_L1_error)
41933  __Pyx_GOTREF(__pyx_tuple__18);
41934  __Pyx_GIVEREF(__pyx_tuple__18);
41935 
41936  /* "(tree fragment)":2
41937  * def __reduce_cython__(self):
41938  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
41939  * def __setstate_cython__(self, __pyx_state):
41940  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
41941  */
41942  __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(2, 2, __pyx_L1_error)
41943  __Pyx_GOTREF(__pyx_tuple__19);
41944  __Pyx_GIVEREF(__pyx_tuple__19);
41945 
41946  /* "(tree fragment)":4
41947  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
41948  * def __setstate_cython__(self, __pyx_state):
41949  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
41950  */
41951  __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(2, 4, __pyx_L1_error)
41952  __Pyx_GOTREF(__pyx_tuple__20);
41953  __Pyx_GIVEREF(__pyx_tuple__20);
41954 
41955  /* "View.MemoryView":418
41956  * def __setitem__(memoryview self, object index, object value):
41957  * if self.view.readonly:
41958  * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<<
41959  *
41960  * have_slices, index = _unellipsify(index, self.view.ndim)
41961  */
41962  __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(2, 418, __pyx_L1_error)
41963  __Pyx_GOTREF(__pyx_tuple__21);
41964  __Pyx_GIVEREF(__pyx_tuple__21);
41965 
41966  /* "View.MemoryView":495
41967  * result = struct.unpack(self.view.format, bytesitem)
41968  * except struct.error:
41969  * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<<
41970  * else:
41971  * if len(self.view.format) == 1:
41972  */
41973  __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(2, 495, __pyx_L1_error)
41974  __Pyx_GOTREF(__pyx_tuple__22);
41975  __Pyx_GIVEREF(__pyx_tuple__22);
41976 
41977  /* "View.MemoryView":520
41978  * def __getbuffer__(self, Py_buffer *info, int flags):
41979  * if flags & PyBUF_WRITABLE and self.view.readonly:
41980  * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<<
41981  *
41982  * if flags & PyBUF_ND:
41983  */
41984  __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(2, 520, __pyx_L1_error)
41985  __Pyx_GOTREF(__pyx_tuple__23);
41986  __Pyx_GIVEREF(__pyx_tuple__23);
41987 
41988  /* "View.MemoryView":570
41989  * if self.view.strides == NULL:
41990  *
41991  * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<<
41992  *
41993  * return tuple([stride for stride in self.view.strides[:self.view.ndim]])
41994  */
41995  __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(2, 570, __pyx_L1_error)
41996  __Pyx_GOTREF(__pyx_tuple__24);
41997  __Pyx_GIVEREF(__pyx_tuple__24);
41998 
41999  /* "View.MemoryView":577
42000  * def suboffsets(self):
42001  * if self.view.suboffsets == NULL:
42002  * return (-1,) * self.view.ndim # <<<<<<<<<<<<<<
42003  *
42004  * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
42005  */
42006  __pyx_tuple__25 = PyTuple_New(1); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(2, 577, __pyx_L1_error)
42007  __Pyx_GOTREF(__pyx_tuple__25);
42008  __Pyx_INCREF(__pyx_int_neg_1);
42009  __Pyx_GIVEREF(__pyx_int_neg_1);
42010  PyTuple_SET_ITEM(__pyx_tuple__25, 0, __pyx_int_neg_1);
42011  __Pyx_GIVEREF(__pyx_tuple__25);
42012 
42013  /* "(tree fragment)":2
42014  * def __reduce_cython__(self):
42015  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
42016  * def __setstate_cython__(self, __pyx_state):
42017  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
42018  */
42019  __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(2, 2, __pyx_L1_error)
42020  __Pyx_GOTREF(__pyx_tuple__26);
42021  __Pyx_GIVEREF(__pyx_tuple__26);
42022 
42023  /* "(tree fragment)":4
42024  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
42025  * def __setstate_cython__(self, __pyx_state):
42026  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
42027  */
42028  __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(2, 4, __pyx_L1_error)
42029  __Pyx_GOTREF(__pyx_tuple__27);
42030  __Pyx_GIVEREF(__pyx_tuple__27);
42031 
42032  /* "View.MemoryView":703
42033  * for suboffset in suboffsets[:ndim]:
42034  * if suboffset >= 0:
42035  * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<<
42036  *
42037  *
42038  */
42039  __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(2, 703, __pyx_L1_error)
42040  __Pyx_GOTREF(__pyx_tuple__28);
42041  __Pyx_GIVEREF(__pyx_tuple__28);
42042 
42043  /* "(tree fragment)":2
42044  * def __reduce_cython__(self):
42045  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
42046  * def __setstate_cython__(self, __pyx_state):
42047  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
42048  */
42049  __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(2, 2, __pyx_L1_error)
42050  __Pyx_GOTREF(__pyx_tuple__29);
42051  __Pyx_GIVEREF(__pyx_tuple__29);
42052 
42053  /* "(tree fragment)":4
42054  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
42055  * def __setstate_cython__(self, __pyx_state):
42056  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
42057  */
42058  __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(2, 4, __pyx_L1_error)
42059  __Pyx_GOTREF(__pyx_tuple__30);
42060  __Pyx_GIVEREF(__pyx_tuple__30);
42061 
42062  /* "mprans/MeshSmoothing.pyx":11
42063  * from proteus.Profiling import logEvent
42064  *
42065  * def smoothNodesLaplace(double[:,:] nodeArray_, # <<<<<<<<<<<<<<
42066  * int[:] nodeStarOffsets,
42067  * int[:] nodeStarArray,
42068  */
42069  __pyx_tuple__36 = PyTuple_Pack(10, __pyx_n_s_nodeArray, __pyx_n_s_nodeStarOffsets, __pyx_n_s_nodeStarArray, __pyx_n_s_nodeMaterialTypes, __pyx_n_s_nNodes_owned, __pyx_n_s_nd, __pyx_n_s_simultaneous, __pyx_n_s_smoothBoundaries, __pyx_n_s_fixedNodesBoolArray, __pyx_n_s_alpha); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 11, __pyx_L1_error)
42070  __Pyx_GOTREF(__pyx_tuple__36);
42071  __Pyx_GIVEREF(__pyx_tuple__36);
42072  __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(10, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_smoothNodesLaplace, 11, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 11, __pyx_L1_error)
42073 
42074  /* "mprans/MeshSmoothing.pyx":64
42075  * alpha=alpha)
42076  *
42077  * def smoothNodesCentroid(double[:,:] nodeArray_, # <<<<<<<<<<<<<<
42078  * int[:] nodeElementOffsets,
42079  * int[:] nodeElementsArray,
42080  */
42081  __pyx_tuple__38 = PyTuple_Pack(12, __pyx_n_s_nodeArray, __pyx_n_s_nodeElementOffsets, __pyx_n_s_nodeElementsArray, __pyx_n_s_nodeMaterialTypes, __pyx_n_s_elementBarycentersArray, __pyx_n_s_elementVolumesArray, __pyx_n_s_elementNodesArray, __pyx_n_s_nNodes_owned, __pyx_n_s_simultaneous, __pyx_n_s_smoothBoundaries, __pyx_n_s_fixedNodesBoolArray, __pyx_n_s_alpha); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 64, __pyx_L1_error)
42082  __Pyx_GOTREF(__pyx_tuple__38);
42083  __Pyx_GIVEREF(__pyx_tuple__38);
42084  __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(12, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_smoothNodesCentroid, 64, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 64, __pyx_L1_error)
42085 
42086  /* "mprans/MeshSmoothing.pyx":127
42087  * alpha=alpha)
42088  *
42089  * def updateDilationElements(double[:] elementDilationArray_, # <<<<<<<<<<<<<<
42090  * double[:] elementVolumeArray,
42091  * double[:] elementVolumeTargetArray,
42092  */
42093  __pyx_tuple__40 = PyTuple_Pack(4, __pyx_n_s_elementDilationArray, __pyx_n_s_elementVolumeArray, __pyx_n_s_elementVolumeTargetArray, __pyx_n_s_nElements); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 127, __pyx_L1_error)
42094  __Pyx_GOTREF(__pyx_tuple__40);
42095  __Pyx_GIVEREF(__pyx_tuple__40);
42096  __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_updateDilationElements, 127, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 127, __pyx_L1_error)
42097 
42098  /* "mprans/MeshSmoothing.pyx":136
42099  * nElements=nElements)
42100  *
42101  * def getDilationElements(double[:] elementVolumeArray, # <<<<<<<<<<<<<<
42102  * double[:] elementVolumeTargetArray):
42103  * cdef int nElements = len(elementVolumeArray)
42104  */
42105  __pyx_tuple__42 = PyTuple_Pack(4, __pyx_n_s_elementVolumeArray, __pyx_n_s_elementVolumeTargetArray, __pyx_n_s_nElements, __pyx_n_s_elementDilationArray); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 136, __pyx_L1_error)
42106  __Pyx_GOTREF(__pyx_tuple__42);
42107  __Pyx_GIVEREF(__pyx_tuple__42);
42108  __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_getDilationElements, 136, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 136, __pyx_L1_error)
42109 
42110  /* "mprans/MeshSmoothing.pyx":146
42111  * return elementDilationArray_
42112  *
42113  * def updateDistortionElements(double[:] elementDistortionArray_, # <<<<<<<<<<<<<<
42114  * double[:,:,:,:] J_array,
42115  * double[:,:] detJ_array,
42116  */
42117  __pyx_tuple__44 = PyTuple_Pack(5, __pyx_n_s_elementDistortionArray, __pyx_n_s_J_array, __pyx_n_s_detJ_array, __pyx_n_s_nd, __pyx_n_s_nElements); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 146, __pyx_L1_error)
42118  __Pyx_GOTREF(__pyx_tuple__44);
42119  __Pyx_GIVEREF(__pyx_tuple__44);
42120  __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_updateDistortionElements, 146, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 146, __pyx_L1_error)
42121 
42122  /* "mprans/MeshSmoothing.pyx":157
42123  * nElements=nElements)
42124  *
42125  * def getDistortionElements(double[:,:,:,:] J_array, # <<<<<<<<<<<<<<
42126  * double[:,:] detJ_array,
42127  * int nd):
42128  */
42129  __pyx_tuple__46 = PyTuple_Pack(5, __pyx_n_s_J_array, __pyx_n_s_detJ_array, __pyx_n_s_nd, __pyx_n_s_nElements, __pyx_n_s_elementDistortionArray); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 157, __pyx_L1_error)
42130  __Pyx_GOTREF(__pyx_tuple__46);
42131  __Pyx_GIVEREF(__pyx_tuple__46);
42132  __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_getDistortionElements, 157, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 157, __pyx_L1_error)
42133 
42134  /* "mprans/MeshSmoothing.pyx":169
42135  * return elementDistortionArray_
42136  *
42137  * def updateInverseMeanRatioTriangleElements(double[:] IMRElementsArray_, # <<<<<<<<<<<<<<
42138  * double[:,:] nodeArray,
42139  * int[:,:] elementNodesArray,
42140  */
42141  __pyx_tuple__48 = PyTuple_Pack(4, __pyx_n_s_IMRElementsArray, __pyx_n_s_nodeArray_2, __pyx_n_s_elementNodesArray, __pyx_n_s_nElements); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 169, __pyx_L1_error)
42142  __Pyx_GOTREF(__pyx_tuple__48);
42143  __Pyx_GIVEREF(__pyx_tuple__48);
42144  __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_updateInverseMeanRatioTriangleEl, 169, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 169, __pyx_L1_error)
42145 
42146  /* "mprans/MeshSmoothing.pyx":178
42147  * nElements=nElements)
42148  *
42149  * def getInverseMeanRatioTriangleElements(double[:,:] nodeArray, # <<<<<<<<<<<<<<
42150  * int[:,:] elementNodesArray):
42151  * cdef int nElements = len(elementNodesArray)
42152  */
42153  __pyx_tuple__50 = PyTuple_Pack(4, __pyx_n_s_nodeArray_2, __pyx_n_s_elementNodesArray, __pyx_n_s_nElements, __pyx_n_s_IMRElementsArray); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 178, __pyx_L1_error)
42154  __Pyx_GOTREF(__pyx_tuple__50);
42155  __Pyx_GIVEREF(__pyx_tuple__50);
42156  __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_getInverseMeanRatioTriangleEleme, 178, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 178, __pyx_L1_error)
42157 
42158  /* "mprans/MeshSmoothing.pyx":188
42159  * return IMRElementsArray_
42160  *
42161  * def updateInverseMeanRatioTriangleNodes(double[:] IMRNodesArray_, # <<<<<<<<<<<<<<
42162  * double[:,:] nodeArray,
42163  * int[:,:] elementNodesArray,
42164  */
42165  __pyx_tuple__52 = PyTuple_Pack(8, __pyx_n_s_IMRNodesArray, __pyx_n_s_nodeArray_2, __pyx_n_s_elementNodesArray, __pyx_n_s_nodeElementOffsets, __pyx_n_s_nodeElementsArray, __pyx_n_s_nNodes, __pyx_n_s_nElements, __pyx_n_s_el_average); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 188, __pyx_L1_error)
42166  __Pyx_GOTREF(__pyx_tuple__52);
42167  __Pyx_GIVEREF(__pyx_tuple__52);
42168  __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(8, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_updateInverseMeanRatioTriangleNo, 188, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 188, __pyx_L1_error)
42169 
42170  /* "mprans/MeshSmoothing.pyx":205
42171  * nElements=nElements)
42172  *
42173  * def getInverseMeanRatioTriangleNodes(double[:,:] nodeArray, # <<<<<<<<<<<<<<
42174  * int[:,:] elementNodesArray,
42175  * int[:] nodeElementOffsets,
42176  */
42177  __pyx_tuple__54 = PyTuple_Pack(8, __pyx_n_s_nodeArray_2, __pyx_n_s_elementNodesArray, __pyx_n_s_nodeElementOffsets, __pyx_n_s_nodeElementsArray, __pyx_n_s_el_average, __pyx_n_s_nNodes, __pyx_n_s_nElements, __pyx_n_s_IMRNodesArray); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 205, __pyx_L1_error)
42178  __Pyx_GOTREF(__pyx_tuple__54);
42179  __Pyx_GIVEREF(__pyx_tuple__54);
42180  __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(5, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_getInverseMeanRatioTriangleNodes, 205, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 205, __pyx_L1_error)
42181 
42182  /* "mprans/MeshSmoothing.pyx":223
42183  * return IMRNodesArray_
42184  *
42185  * def getInverseMeanRatioSingleTriangle(int node0, # <<<<<<<<<<<<<<
42186  * double[:,:] nodeArray,
42187  * int[:,:] elementNodesArray,
42188  */
42189  __pyx_tuple__56 = PyTuple_Pack(5, __pyx_n_s_node0, __pyx_n_s_nodeArray_2, __pyx_n_s_elementNodesArray, __pyx_n_s_nodeElementOffsets, __pyx_n_s_nodeElementsArray); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 223, __pyx_L1_error)
42190  __Pyx_GOTREF(__pyx_tuple__56);
42191  __Pyx_GIVEREF(__pyx_tuple__56);
42192  __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_getInverseMeanRatioSingleTriangl, 223, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 223, __pyx_L1_error)
42193 
42194  /* "mprans/MeshSmoothing.pyx":234
42195  * nodeElementsArray=nodeElementsArray)
42196  *
42197  * def smoothNodesQuality(double[:] distortion, # <<<<<<<<<<<<<<
42198  * double[:] dilation,
42199  * double[:,:] nodeArray,
42200  */
42201  __pyx_tuple__58 = PyTuple_Pack(9, __pyx_n_s_distortion, __pyx_n_s_dilation, __pyx_n_s_nodeArray_2, __pyx_n_s_nNodes_owned, __pyx_n_s_nodeMaterialTypes, __pyx_n_s_nodeElementOffsets, __pyx_n_s_nodeElementsArray, __pyx_n_s_elementNodesArray, __pyx_n_s_apply_directly); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(0, 234, __pyx_L1_error)
42202  __Pyx_GOTREF(__pyx_tuple__58);
42203  __Pyx_GIVEREF(__pyx_tuple__58);
42204  __pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(9, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__58, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_smoothNodesQuality, 234, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(0, 234, __pyx_L1_error)
42205 
42206  /* "mprans/MeshSmoothing.pyx":254
42207  * apply_directly=False)
42208  *
42209  * def getLocalNearestNode(double[:] coords, # <<<<<<<<<<<<<<
42210  * double[:,:] nodeArray,
42211  * int[:] nodeStarOffsets,
42212  */
42213  __pyx_tuple__60 = PyTuple_Pack(5, __pyx_n_s_coords, __pyx_n_s_nodeArray_2, __pyx_n_s_nodeStarOffsets, __pyx_n_s_nodeStarArray, __pyx_n_s_node); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 254, __pyx_L1_error)
42214  __Pyx_GOTREF(__pyx_tuple__60);
42215  __Pyx_GIVEREF(__pyx_tuple__60);
42216  __pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_getLocalNearestNode, 254, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(0, 254, __pyx_L1_error)
42217 
42218  /* "mprans/MeshSmoothing.pyx":285
42219  * node)
42220  *
42221  * def getLocalNearestElement(double[:] coords, # <<<<<<<<<<<<<<
42222  * double[:,:] elementBarycentersArray,
42223  * int[:,:] elementNeighborsArray,
42224  */
42225  __pyx_tuple__62 = PyTuple_Pack(4, __pyx_n_s_coords, __pyx_n_s_elementBarycentersArray, __pyx_n_s_elementNeighborsArray, __pyx_n_s_eN); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(0, 285, __pyx_L1_error)
42226  __Pyx_GOTREF(__pyx_tuple__62);
42227  __Pyx_GIVEREF(__pyx_tuple__62);
42228  __pyx_codeobj__63 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__62, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_getLocalNearestElement, 285, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__63)) __PYX_ERR(0, 285, __pyx_L1_error)
42229 
42230  /* "mprans/MeshSmoothing.pyx":312
42231  * eN)
42232  *
42233  * def getLocalNearestElementAroundNode(double[:] coords, # <<<<<<<<<<<<<<
42234  * int[:] nodeElementOffsets,
42235  * int[:] nodeElementsArray,
42236  */
42237  __pyx_tuple__64 = PyTuple_Pack(5, __pyx_n_s_coords, __pyx_n_s_nodeElementOffsets, __pyx_n_s_nodeElementsArray, __pyx_n_s_elementBarycentersArray, __pyx_n_s_node); if (unlikely(!__pyx_tuple__64)) __PYX_ERR(0, 312, __pyx_L1_error)
42238  __Pyx_GOTREF(__pyx_tuple__64);
42239  __Pyx_GIVEREF(__pyx_tuple__64);
42240  __pyx_codeobj__65 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__64, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_getLocalNearestElementAroundNode, 312, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__65)) __PYX_ERR(0, 312, __pyx_L1_error)
42241 
42242  /* "mprans/MeshSmoothing.pyx":343
42243  * node=node)
42244  *
42245  * def getLocalNearestElementIntersection(double[:] coords, # <<<<<<<<<<<<<<
42246  * double[:] starting_coords,
42247  * double[:,:,:] elementBoundaryNormalsArray,
42248  */
42249  __pyx_tuple__66 = PyTuple_Pack(8, __pyx_n_s_coords, __pyx_n_s_starting_coords, __pyx_n_s_elementBoundaryNormalsArray, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryBarycentersArray, __pyx_n_s_elementBoundaryElementsArray, __pyx_n_s_exteriorElementBoundariesBoolArr, __pyx_n_s_eN); if (unlikely(!__pyx_tuple__66)) __PYX_ERR(0, 343, __pyx_L1_error)
42250  __Pyx_GOTREF(__pyx_tuple__66);
42251  __Pyx_GIVEREF(__pyx_tuple__66);
42252  __pyx_codeobj__67 = (PyObject*)__Pyx_PyCode_New(8, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__66, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_getLocalNearestElementIntersecti, 343, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__67)) __PYX_ERR(0, 343, __pyx_L1_error)
42253 
42254  /* "mprans/MeshSmoothing.pyx":388
42255  * eN=eN)
42256  *
42257  * def getLocalElement(femSpace, # <<<<<<<<<<<<<<
42258  * coords,
42259  * node):
42260  */
42261  __pyx_tuple__68 = PyTuple_Pack(8, __pyx_n_s_femSpace, __pyx_n_s_coords, __pyx_n_s_node, __pyx_n_s_patchBoundaryNodes, __pyx_n_s_checkedElements, __pyx_n_s_eOffset, __pyx_n_s_eN, __pyx_n_s_xi); if (unlikely(!__pyx_tuple__68)) __PYX_ERR(0, 388, __pyx_L1_error)
42262  __Pyx_GOTREF(__pyx_tuple__68);
42263  __Pyx_GIVEREF(__pyx_tuple__68);
42264  __pyx_codeobj__69 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__68, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_getLocalElement, 388, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__69)) __PYX_ERR(0, 388, __pyx_L1_error)
42265 
42266  /* "mprans/MeshSmoothing.pyx":452
42267  *
42268  *
42269  * def updateElementBoundaryNormalsTriangle(double[:,:,:] elementBoundaryNormalsArray_, # <<<<<<<<<<<<<<
42270  * double[:,:] nodeArray,
42271  * int[:,:] elementBoundariesArray,
42272  */
42273  __pyx_tuple__70 = PyTuple_Pack(7, __pyx_n_s_elementBoundaryNormalsArray_2, __pyx_n_s_nodeArray_2, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryNodesArray, __pyx_n_s_elementBoundaryBarycentersArray, __pyx_n_s_elementBarycentersArray, __pyx_n_s_nElements); if (unlikely(!__pyx_tuple__70)) __PYX_ERR(0, 452, __pyx_L1_error)
42274  __Pyx_GOTREF(__pyx_tuple__70);
42275  __Pyx_GIVEREF(__pyx_tuple__70);
42276  __pyx_codeobj__71 = (PyObject*)__Pyx_PyCode_New(7, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__70, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_updateElementBoundaryNormalsTria, 452, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__71)) __PYX_ERR(0, 452, __pyx_L1_error)
42277 
42278  /* "mprans/MeshSmoothing.pyx":467
42279  * nElements=nElements)
42280  *
42281  * def getElementBoundaryNormalsTriangle(double[:,:] nodeArray, # <<<<<<<<<<<<<<
42282  * int[:,:] elementBoundariesArray,
42283  * int[:,:] elementBoundaryNodesArray,
42284  */
42285  __pyx_tuple__72 = PyTuple_Pack(7, __pyx_n_s_nodeArray_2, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryNodesArray, __pyx_n_s_elementBoundaryBarycentersArray, __pyx_n_s_elementBarycentersArray, __pyx_n_s_elementBoundaryNormalsArray_2, __pyx_n_s_nElements); if (unlikely(!__pyx_tuple__72)) __PYX_ERR(0, 467, __pyx_L1_error)
42286  __Pyx_GOTREF(__pyx_tuple__72);
42287  __Pyx_GIVEREF(__pyx_tuple__72);
42288  __pyx_codeobj__73 = (PyObject*)__Pyx_PyCode_New(5, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__72, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_getElementBoundaryNormalsTriangl, 467, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__73)) __PYX_ERR(0, 467, __pyx_L1_error)
42289 
42290  /* "mprans/MeshSmoothing.pyx":483
42291  * return elementBoundaryNormalsArray_
42292  *
42293  * def updateElementBoundaryNormalsTetra(double[:,:,:] elementBoundaryNormalsArray_, # <<<<<<<<<<<<<<
42294  * double[:,:] nodeArray,
42295  * int[:,:] elementBoundariesArray,
42296  */
42297  __pyx_tuple__74 = PyTuple_Pack(7, __pyx_n_s_elementBoundaryNormalsArray_2, __pyx_n_s_nodeArray_2, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryNodesArray, __pyx_n_s_elementBoundaryBarycentersArray, __pyx_n_s_elementBarycentersArray, __pyx_n_s_nElements); if (unlikely(!__pyx_tuple__74)) __PYX_ERR(0, 483, __pyx_L1_error)
42298  __Pyx_GOTREF(__pyx_tuple__74);
42299  __Pyx_GIVEREF(__pyx_tuple__74);
42300  __pyx_codeobj__75 = (PyObject*)__Pyx_PyCode_New(7, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__74, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_updateElementBoundaryNormalsTetr, 483, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__75)) __PYX_ERR(0, 483, __pyx_L1_error)
42301 
42302  /* "mprans/MeshSmoothing.pyx":498
42303  * nElements=nElements)
42304  *
42305  * def getElementBoundaryNormalsTetra(double[:,:] nodeArray, # <<<<<<<<<<<<<<
42306  * int[:,:] elementBoundariesArray,
42307  * int[:,:] elementBoundaryNodesArray,
42308  */
42309  __pyx_tuple__76 = PyTuple_Pack(7, __pyx_n_s_nodeArray_2, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryNodesArray, __pyx_n_s_elementBoundaryBarycentersArray, __pyx_n_s_elementBarycentersArray, __pyx_n_s_elementBoundaryNormalsArray_2, __pyx_n_s_nElements); if (unlikely(!__pyx_tuple__76)) __PYX_ERR(0, 498, __pyx_L1_error)
42310  __Pyx_GOTREF(__pyx_tuple__76);
42311  __Pyx_GIVEREF(__pyx_tuple__76);
42312  __pyx_codeobj__77 = (PyObject*)__Pyx_PyCode_New(5, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__76, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_getElementBoundaryNormalsTetra, 498, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__77)) __PYX_ERR(0, 498, __pyx_L1_error)
42313 
42314  /* "mprans/MeshSmoothing.pyx":514
42315  * return elementBoundaryNormalsArray_
42316  *
42317  * def updateElementVolumesTriangle(double[:] elementVolumesArray_, # <<<<<<<<<<<<<<
42318  * int[:,:] elementNodesArray,
42319  * double[:,:] nodeArray,
42320  */
42321  __pyx_tuple__78 = PyTuple_Pack(4, __pyx_n_s_elementVolumesArray_2, __pyx_n_s_elementNodesArray, __pyx_n_s_nodeArray_2, __pyx_n_s_nElements); if (unlikely(!__pyx_tuple__78)) __PYX_ERR(0, 514, __pyx_L1_error)
42322  __Pyx_GOTREF(__pyx_tuple__78);
42323  __Pyx_GIVEREF(__pyx_tuple__78);
42324  __pyx_codeobj__79 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__78, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_updateElementVolumesTriangle, 514, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__79)) __PYX_ERR(0, 514, __pyx_L1_error)
42325 
42326  /* "mprans/MeshSmoothing.pyx":523
42327  * nElements=nElements)
42328  *
42329  * def getElementVolumeTriangle(double[:] nA, # <<<<<<<<<<<<<<
42330  * double[:] nB,
42331  * double[:] nC):
42332  */
42333  __pyx_tuple__80 = PyTuple_Pack(3, __pyx_n_s_nA, __pyx_n_s_nB, __pyx_n_s_nC); if (unlikely(!__pyx_tuple__80)) __PYX_ERR(0, 523, __pyx_L1_error)
42334  __Pyx_GOTREF(__pyx_tuple__80);
42335  __Pyx_GIVEREF(__pyx_tuple__80);
42336  __pyx_codeobj__81 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__80, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_getElementVolumeTriangle, 523, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__81)) __PYX_ERR(0, 523, __pyx_L1_error)
42337 
42338  /* "mprans/MeshSmoothing.pyx":530
42339  * nC=nC)
42340  *
42341  * def updateElementVolumesTetra(double[:] elementVolumesArray_, # <<<<<<<<<<<<<<
42342  * int[:,:] elementNodesArray,
42343  * double[:,:] nodeArray,
42344  */
42345  __pyx_tuple__82 = PyTuple_Pack(4, __pyx_n_s_elementVolumesArray_2, __pyx_n_s_elementNodesArray, __pyx_n_s_nodeArray_2, __pyx_n_s_nElements); if (unlikely(!__pyx_tuple__82)) __PYX_ERR(0, 530, __pyx_L1_error)
42346  __Pyx_GOTREF(__pyx_tuple__82);
42347  __Pyx_GIVEREF(__pyx_tuple__82);
42348  __pyx_codeobj__83 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__82, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_updateElementVolumesTetra, 530, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__83)) __PYX_ERR(0, 530, __pyx_L1_error)
42349 
42350  /* "mprans/MeshSmoothing.pyx":539
42351  * nElements=nElements)
42352  *
42353  * def updateElementBarycenters(double[:,:] elementBarycentersArray_, # <<<<<<<<<<<<<<
42354  * int[:,:] elementNodesArray,
42355  * double[:,:] nodeArray,
42356  */
42357  __pyx_tuple__84 = PyTuple_Pack(4, __pyx_n_s_elementBarycentersArray_2, __pyx_n_s_elementNodesArray, __pyx_n_s_nodeArray_2, __pyx_n_s_nElements); if (unlikely(!__pyx_tuple__84)) __PYX_ERR(0, 539, __pyx_L1_error)
42358  __Pyx_GOTREF(__pyx_tuple__84);
42359  __Pyx_GIVEREF(__pyx_tuple__84);
42360  __pyx_codeobj__85 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__84, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_updateElementBarycenters, 539, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__85)) __PYX_ERR(0, 539, __pyx_L1_error)
42361 
42362  /* "mprans/MeshSmoothing.pyx":548
42363  * nElements=nElements)
42364  *
42365  * def getCornerNodesTriangle(double[:,:] nodeArray, # <<<<<<<<<<<<<<
42366  * int[:] nodeStarArray,
42367  * int[:] nodeStarOffsets,
42368  */
42369  __pyx_tuple__86 = PyTuple_Pack(5, __pyx_n_s_nodeArray_2, __pyx_n_s_nodeStarArray, __pyx_n_s_nodeStarOffsets, __pyx_n_s_nodeMaterialTypes, __pyx_n_s_nNodes); if (unlikely(!__pyx_tuple__86)) __PYX_ERR(0, 548, __pyx_L1_error)
42370  __Pyx_GOTREF(__pyx_tuple__86);
42371  __Pyx_GIVEREF(__pyx_tuple__86);
42372  __pyx_codeobj__87 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__86, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_getCornerNodesTriangle, 548, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__87)) __PYX_ERR(0, 548, __pyx_L1_error)
42373 
42374  /* "mprans/MeshSmoothing.pyx":559
42375  * nNodes=nNodes)
42376  *
42377  * def getNonOwnedNodeValues(args_, # <<<<<<<<<<<<<<
42378  * int nNodes_owned,
42379  * int nNodes_global,
42380  */
42381  __pyx_tuple__88 = PyTuple_Pack(42, __pyx_n_s_args, __pyx_n_s_nNodes_owned, __pyx_n_s_nNodes_global, __pyx_n_s_nodeNumbering_subdomain2global, __pyx_n_s_nodeOffsets_subdomain_owned, __pyx_n_s_Comm, __pyx_n_s_comm, __pyx_n_s_comm_size, __pyx_n_s_my_rank, __pyx_n_s_arg_2rank, __pyx_n_s_nodes_2rank, __pyx_n_s_result, __pyx_n_s_counts_in, __pyx_n_s_displacements_in, __pyx_n_s_counts_out, __pyx_n_s_displacements_out, __pyx_n_s_arg_shape, __pyx_n_s_arg_shape_copy, __pyx_n_s_arg_shape_len, __pyx_n_s_shape_factor, __pyx_n_s_disp, __pyx_n_s_rank, __pyx_n_s_rank_recv, __pyx_n_s_ii, __pyx_n_s_ir, __pyx_n_s_iN, __pyx_n_s_node_new_rank, __pyx_n_s_new_rank, __pyx_n_s_sumtot, __pyx_n_s_nodes_2rank_values, __pyx_n_s_nodes_2doArray, __pyx_n_s_i, __pyx_n_s_node, __pyx_n_s_nodes_2rank_len, __pyx_n_s_array_size, __pyx_n_s_my_size, __pyx_n_s_arg_2rank_values, __pyx_n_s_arg_2doArray, __pyx_n_s_datatype, __pyx_n_s_genexpr, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__88)) __PYX_ERR(0, 559, __pyx_L1_error)
42382  __Pyx_GOTREF(__pyx_tuple__88);
42383  __Pyx_GIVEREF(__pyx_tuple__88);
42384  __pyx_codeobj__89 = (PyObject*)__Pyx_PyCode_New(5, 0, 42, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__88, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_getNonOwnedNodeValues, 559, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__89)) __PYX_ERR(0, 559, __pyx_L1_error)
42385 
42386  /* "mprans/MeshSmoothing.pyx":690
42387  * # nproc=str(comm_size)))
42388  *
42389  * def checkOwnedVariable(int variable_nb_local, # <<<<<<<<<<<<<<
42390  * int rank,
42391  * int nVariables_owned,
42392  */
42393  __pyx_tuple__90 = PyTuple_Pack(5, __pyx_n_s_variable_nb_local, __pyx_n_s_rank, __pyx_n_s_nVariables_owned, __pyx_n_s_variableNumbering_subdomain2glob, __pyx_n_s_variableOffsets_subdomain_owned); if (unlikely(!__pyx_tuple__90)) __PYX_ERR(0, 690, __pyx_L1_error)
42394  __Pyx_GOTREF(__pyx_tuple__90);
42395  __Pyx_GIVEREF(__pyx_tuple__90);
42396  __pyx_codeobj__91 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__90, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_checkOwnedVariable, 690, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__91)) __PYX_ERR(0, 690, __pyx_L1_error)
42397 
42398  /* "mprans/MeshSmoothing.pyx":701
42399  * variableOffsets_subdomain_owned=variableOffsets_subdomain_owned)
42400  *
42401  * def pyScalarRecoveryAtNodes(double[:] scalars, # <<<<<<<<<<<<<<
42402  * int[:] nodeElementsArray,
42403  * int[:] nodeElementOffsets):
42404  */
42405  __pyx_tuple__92 = PyTuple_Pack(3, __pyx_n_s_scalars, __pyx_n_s_nodeElementsArray, __pyx_n_s_nodeElementOffsets); if (unlikely(!__pyx_tuple__92)) __PYX_ERR(0, 701, __pyx_L1_error)
42406  __Pyx_GOTREF(__pyx_tuple__92);
42407  __Pyx_GIVEREF(__pyx_tuple__92);
42408  __pyx_codeobj__93 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__92, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_pyScalarRecoveryAtNodes, 701, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__93)) __PYX_ERR(0, 701, __pyx_L1_error)
42409 
42410  /* "mprans/MeshSmoothing.pyx":708
42411  * nodeElementOffsets=nodeElementOffsets)
42412  *
42413  * def pyScalarRecoveryAtNodesWeighted(double[:] scalars, # <<<<<<<<<<<<<<
42414  * int[:] nodeElementsArray,
42415  * int[:] nodeElementOffsets,
42416  */
42417  __pyx_tuple__94 = PyTuple_Pack(5, __pyx_n_s_scalars, __pyx_n_s_nodeElementsArray, __pyx_n_s_nodeElementOffsets, __pyx_n_s_detJ_array, __pyx_n_s_nNodes); if (unlikely(!__pyx_tuple__94)) __PYX_ERR(0, 708, __pyx_L1_error)
42418  __Pyx_GOTREF(__pyx_tuple__94);
42419  __Pyx_GIVEREF(__pyx_tuple__94);
42420  __pyx_codeobj__95 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__94, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_pyScalarRecoveryAtNodesWeighted, 708, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__95)) __PYX_ERR(0, 708, __pyx_L1_error)
42421 
42422  /* "mprans/MeshSmoothing.pyx":719
42423  * nNodes=nNodes)
42424  *
42425  * def pyVectorRecoveryAtNodes(vectors, # <<<<<<<<<<<<<<
42426  * nodeElementsArray,
42427  * nodeElementOffsets,
42428  */
42429  __pyx_tuple__96 = PyTuple_Pack(4, __pyx_n_s_vectors, __pyx_n_s_nodeElementsArray, __pyx_n_s_nodeElementOffsets, __pyx_n_s_nd); if (unlikely(!__pyx_tuple__96)) __PYX_ERR(0, 719, __pyx_L1_error)
42430  __Pyx_GOTREF(__pyx_tuple__96);
42431  __Pyx_GIVEREF(__pyx_tuple__96);
42432  __pyx_codeobj__97 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__96, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_pyVectorRecoveryAtNodes, 719, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__97)) __PYX_ERR(0, 719, __pyx_L1_error)
42433 
42434  /* "mprans/MeshSmoothing.pyx":728
42435  * nd=nd)
42436  *
42437  * def pyVectorRecoveryAtNodesWeighted(double[:,:] vectors, # <<<<<<<<<<<<<<
42438  * int[:] nodeElementsArray,
42439  * int[:] nodeElementOffsets,
42440  */
42441  __pyx_tuple__98 = PyTuple_Pack(5, __pyx_n_s_vectors, __pyx_n_s_nodeElementsArray, __pyx_n_s_nodeElementOffsets, __pyx_n_s_detJ_array, __pyx_n_s_nd); if (unlikely(!__pyx_tuple__98)) __PYX_ERR(0, 728, __pyx_L1_error)
42442  __Pyx_GOTREF(__pyx_tuple__98);
42443  __Pyx_GIVEREF(__pyx_tuple__98);
42444  __pyx_codeobj__99 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__98, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_pyVectorRecoveryAtNodesWeighted, 728, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__99)) __PYX_ERR(0, 728, __pyx_L1_error)
42445 
42446  /* "View.MemoryView":286
42447  * return self.name
42448  *
42449  * cdef generic = Enum("<strided and direct or indirect>") # <<<<<<<<<<<<<<
42450  * cdef strided = Enum("<strided and direct>") # default
42451  * cdef indirect = Enum("<strided and indirect>")
42452  */
42453  __pyx_tuple__100 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__100)) __PYX_ERR(2, 286, __pyx_L1_error)
42454  __Pyx_GOTREF(__pyx_tuple__100);
42455  __Pyx_GIVEREF(__pyx_tuple__100);
42456 
42457  /* "View.MemoryView":287
42458  *
42459  * cdef generic = Enum("<strided and direct or indirect>")
42460  * cdef strided = Enum("<strided and direct>") # default # <<<<<<<<<<<<<<
42461  * cdef indirect = Enum("<strided and indirect>")
42462  *
42463  */
42464  __pyx_tuple__101 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__101)) __PYX_ERR(2, 287, __pyx_L1_error)
42465  __Pyx_GOTREF(__pyx_tuple__101);
42466  __Pyx_GIVEREF(__pyx_tuple__101);
42467 
42468  /* "View.MemoryView":288
42469  * cdef generic = Enum("<strided and direct or indirect>")
42470  * cdef strided = Enum("<strided and direct>") # default
42471  * cdef indirect = Enum("<strided and indirect>") # <<<<<<<<<<<<<<
42472  *
42473  *
42474  */
42475  __pyx_tuple__102 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__102)) __PYX_ERR(2, 288, __pyx_L1_error)
42476  __Pyx_GOTREF(__pyx_tuple__102);
42477  __Pyx_GIVEREF(__pyx_tuple__102);
42478 
42479  /* "View.MemoryView":291
42480  *
42481  *
42482  * cdef contiguous = Enum("<contiguous and direct>") # <<<<<<<<<<<<<<
42483  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
42484  *
42485  */
42486  __pyx_tuple__103 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__103)) __PYX_ERR(2, 291, __pyx_L1_error)
42487  __Pyx_GOTREF(__pyx_tuple__103);
42488  __Pyx_GIVEREF(__pyx_tuple__103);
42489 
42490  /* "View.MemoryView":292
42491  *
42492  * cdef contiguous = Enum("<contiguous and direct>")
42493  * cdef indirect_contiguous = Enum("<contiguous and indirect>") # <<<<<<<<<<<<<<
42494  *
42495  *
42496  */
42497  __pyx_tuple__104 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__104)) __PYX_ERR(2, 292, __pyx_L1_error)
42498  __Pyx_GOTREF(__pyx_tuple__104);
42499  __Pyx_GIVEREF(__pyx_tuple__104);
42500 
42501  /* "(tree fragment)":1
42502  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
42503  * cdef object __pyx_PickleError
42504  * cdef object __pyx_result
42505  */
42506  __pyx_tuple__105 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__105)) __PYX_ERR(2, 1, __pyx_L1_error)
42507  __Pyx_GOTREF(__pyx_tuple__105);
42508  __Pyx_GIVEREF(__pyx_tuple__105);
42509  __pyx_codeobj__106 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__105, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__106)) __PYX_ERR(2, 1, __pyx_L1_error)
42510  __Pyx_RefNannyFinishContext();
42511  return 0;
42512  __pyx_L1_error:;
42513  __Pyx_RefNannyFinishContext();
42514  return -1;
42515 }
42516 
42517 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
42518  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
42519  __pyx_float_0_ = PyFloat_FromDouble(0.); if (unlikely(!__pyx_float_0_)) __PYX_ERR(0, 1, __pyx_L1_error)
42520  __pyx_float_1_ = PyFloat_FromDouble(1.); if (unlikely(!__pyx_float_1_)) __PYX_ERR(0, 1, __pyx_L1_error)
42521  __pyx_float_0_5 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_float_0_5)) __PYX_ERR(0, 1, __pyx_L1_error)
42522  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
42523  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
42524  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
42525  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error)
42526  __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error)
42527  __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error)
42528  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
42529  return 0;
42530  __pyx_L1_error:;
42531  return -1;
42532 }
42533 
42534 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
42535 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
42536 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
42537 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
42538 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
42539 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
42540 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
42541 
42542 static int __Pyx_modinit_global_init_code(void) {
42543  __Pyx_RefNannyDeclarations
42544  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
42545  /*--- Global init code ---*/
42546  generic = Py_None; Py_INCREF(Py_None);
42547  strided = Py_None; Py_INCREF(Py_None);
42548  indirect = Py_None; Py_INCREF(Py_None);
42549  contiguous = Py_None; Py_INCREF(Py_None);
42550  indirect_contiguous = Py_None; Py_INCREF(Py_None);
42551  __Pyx_RefNannyFinishContext();
42552  return 0;
42553 }
42554 
42555 static int __Pyx_modinit_variable_export_code(void) {
42556  __Pyx_RefNannyDeclarations
42557  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
42558  /*--- Variable export code ---*/
42559  __Pyx_RefNannyFinishContext();
42560  return 0;
42561 }
42562 
42563 static int __Pyx_modinit_function_export_code(void) {
42564  __Pyx_RefNannyDeclarations
42565  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
42566  /*--- Function export code ---*/
42567  if (__Pyx_ExportFunction("cySmoothNodesLaplace", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cySmoothNodesLaplace, "void (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int, int, struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesLaplace *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42568  if (__Pyx_ExportFunction("cySmoothNodesCentroid", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cySmoothNodesCentroid, "void (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int, __Pyx_memviewslice, struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesCentroid *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42569  if (__Pyx_ExportFunction("cyUpdateDilationElements", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyUpdateDilationElements, "void (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42570  if (__Pyx_ExportFunction("cyUpdateDistortionElements", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyUpdateDistortionElements, "void (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42571  if (__Pyx_ExportFunction("cyUpdateInverseMeanRatioTriangleNodes", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyUpdateInverseMeanRatioTriangleNodes, "void (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int, int, struct __pyx_opt_args_6mprans_13MeshSmoothing_cyUpdateInverseMeanRatioTriangleNodes *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42572  if (__Pyx_ExportFunction("cyUpdateInverseMeanRatioTriangleElements", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyUpdateInverseMeanRatioTriangleElements, "void (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42573  if (__Pyx_ExportFunction("cyGetInverseMeanRatioSingleTriangle", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyGetInverseMeanRatioSingleTriangle, "double (int, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, struct __pyx_opt_args_6mprans_13MeshSmoothing_cyGetInverseMeanRatioSingleTriangle *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42574  if (__Pyx_ExportFunction("cySmoothNodesQuality", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cySmoothNodesQuality, "__Pyx_memviewslice (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesQuality *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42575  if (__Pyx_ExportFunction("pyxGetLocalNearestNode", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_pyxGetLocalNearestNode, "int (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42576  if (__Pyx_ExportFunction("pyxGetLocalNearestElement", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_pyxGetLocalNearestElement, "int (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42577  if (__Pyx_ExportFunction("pyxGetLocalNearestElementIntersection", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_pyxGetLocalNearestElementIntersection, "__Pyx_memviewslice (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42578  if (__Pyx_ExportFunction("pyxGetLocalNearestElementAroundNode", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_pyxGetLocalNearestElementAroundNode, "int (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42579  if (__Pyx_ExportFunction("pyxUpdateElementBoundaryNormalsTetra", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_pyxUpdateElementBoundaryNormalsTetra, "void (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42580  if (__Pyx_ExportFunction("pyxUpdateElementBoundaryNormalsTriangle", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_pyxUpdateElementBoundaryNormalsTriangle, "void (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42581  if (__Pyx_ExportFunction("cyUpdateElementVolumesTriangle", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyUpdateElementVolumesTriangle, "void (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42582  if (__Pyx_ExportFunction("cyUpdateElementVolumesTetra", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyUpdateElementVolumesTetra, "void (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42583  if (__Pyx_ExportFunction("cyUpdateElementBarycenters", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyUpdateElementBarycenters, "void (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42584  if (__Pyx_ExportFunction("cyGetCornerNodesTriangle", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyGetCornerNodesTriangle, "PyArrayObject *(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42585  if (__Pyx_ExportFunction("cyCheckOwnedVariable", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyCheckOwnedVariable, "__Pyx_memviewslice (int, int, int, __Pyx_memviewslice, __Pyx_memviewslice)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42586  if (__Pyx_ExportFunction("cyGetGlobalVariable", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyGetGlobalVariable, "__Pyx_memviewslice (int, int, __Pyx_memviewslice, __Pyx_memviewslice)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42587  if (__Pyx_ExportFunction("cyGetLocalVariable", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyGetLocalVariable, "int (int, int, int, __Pyx_memviewslice, __Pyx_memviewslice)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42588  if (__Pyx_ExportFunction("cyScalarRecoveryAtNodes", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyScalarRecoveryAtNodes, "__Pyx_memviewslice (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42589  if (__Pyx_ExportFunction("cyScalarRecoveryAtNodesWeighted", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyScalarRecoveryAtNodesWeighted, "__Pyx_memviewslice (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42590  if (__Pyx_ExportFunction("cyVectorRecoveryAtNodesWeighted", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyVectorRecoveryAtNodesWeighted, "__Pyx_memviewslice (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42591  if (__Pyx_ExportFunction("cyVectorRecoveryAtNodes", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyVectorRecoveryAtNodes, "__Pyx_memviewslice (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42592  if (__Pyx_ExportFunction("cyFindBoundaryDirectionTriangle", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyFindBoundaryDirectionTriangle, "void (__Pyx_memviewslice, int, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42593  if (__Pyx_ExportFunction("cyFindBoundaryDirectionTetra", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyFindBoundaryDirectionTetra, "void (__Pyx_memviewslice, int, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42594  __Pyx_RefNannyFinishContext();
42595  return 0;
42596  __pyx_L1_error:;
42597  __Pyx_RefNannyFinishContext();
42598  return -1;
42599 }
42600 
42601 static int __Pyx_modinit_type_init_code(void) {
42602  __Pyx_RefNannyDeclarations
42603  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
42604  /*--- Type init code ---*/
42605  if (PyType_Ready(&__pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues) < 0) __PYX_ERR(0, 559, __pyx_L1_error)
42606  #if PY_VERSION_HEX < 0x030800B1
42607  __pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues.tp_print = 0;
42608  #endif
42609  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues.tp_dictoffset && __pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues.tp_getattro == PyObject_GenericGetAttr)) {
42610  __pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
42611  }
42612  __pyx_ptype_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues = &__pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues;
42613  if (PyType_Ready(&__pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
42614  #if PY_VERSION_HEX < 0x030800B1
42615  __pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr.tp_print = 0;
42616  #endif
42617  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr.tp_dictoffset && __pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
42618  __pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
42619  }
42620  __pyx_ptype_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr = &__pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr;
42621  if (PyType_Ready(&__pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr) < 0) __PYX_ERR(0, 626, __pyx_L1_error)
42622  #if PY_VERSION_HEX < 0x030800B1
42623  __pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr.tp_print = 0;
42624  #endif
42625  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr.tp_dictoffset && __pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
42626  __pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
42627  }
42628  __pyx_ptype_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr = &__pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr;
42629  __pyx_vtabptr_array = &__pyx_vtable_array;
42630  __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview;
42631  if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
42632  #if PY_VERSION_HEX < 0x030800B1
42633  __pyx_type___pyx_array.tp_print = 0;
42634  #endif
42635  if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
42636  if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
42637  __pyx_array_type = &__pyx_type___pyx_array;
42638  if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 279, __pyx_L1_error)
42639  #if PY_VERSION_HEX < 0x030800B1
42640  __pyx_type___pyx_MemviewEnum.tp_print = 0;
42641  #endif
42642  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) {
42643  __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr;
42644  }
42645  if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 279, __pyx_L1_error)
42646  __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
42647  __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
42648  __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
42649  __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
42650  __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
42651  __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
42652  __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
42653  __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object;
42654  __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
42655  if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
42656  #if PY_VERSION_HEX < 0x030800B1
42657  __pyx_type___pyx_memoryview.tp_print = 0;
42658  #endif
42659  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) {
42660  __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr;
42661  }
42662  if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
42663  if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
42664  __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
42665  __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
42666  __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
42667  __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
42668  __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
42669  __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
42670  if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error)
42671  #if PY_VERSION_HEX < 0x030800B1
42672  __pyx_type___pyx_memoryviewslice.tp_print = 0;
42673  #endif
42674  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) {
42675  __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr;
42676  }
42677  if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error)
42678  if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error)
42679  __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
42680  __Pyx_RefNannyFinishContext();
42681  return 0;
42682  __pyx_L1_error:;
42683  __Pyx_RefNannyFinishContext();
42684  return -1;
42685 }
42686 
42687 static int __Pyx_modinit_type_import_code(void) {
42688  __Pyx_RefNannyDeclarations
42689  PyObject *__pyx_t_1 = NULL;
42690  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
42691  /*--- Type import code ---*/
42692  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error)
42693  __Pyx_GOTREF(__pyx_t_1);
42694  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
42695  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
42696  sizeof(PyTypeObject),
42697  #else
42698  sizeof(PyHeapTypeObject),
42699  #endif
42700  __Pyx_ImportType_CheckSize_Warn);
42701  if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error)
42702  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
42703  __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 206, __pyx_L1_error)
42704  __Pyx_GOTREF(__pyx_t_1);
42705  __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
42706  if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 206, __pyx_L1_error)
42707  __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Warn);
42708  if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 229, __pyx_L1_error)
42709  __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Warn);
42710  if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 233, __pyx_L1_error)
42711  __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
42712  if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 242, __pyx_L1_error)
42713  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Warn);
42714  if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 918, __pyx_L1_error)
42715  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
42716  __Pyx_RefNannyFinishContext();
42717  return 0;
42718  __pyx_L1_error:;
42719  __Pyx_XDECREF(__pyx_t_1);
42720  __Pyx_RefNannyFinishContext();
42721  return -1;
42722 }
42723 
42724 static int __Pyx_modinit_variable_import_code(void) {
42725  __Pyx_RefNannyDeclarations
42726  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
42727  /*--- Variable import code ---*/
42728  __Pyx_RefNannyFinishContext();
42729  return 0;
42730 }
42731 
42732 static int __Pyx_modinit_function_import_code(void) {
42733  __Pyx_RefNannyDeclarations
42734  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
42735  /*--- Function import code ---*/
42736  __Pyx_RefNannyFinishContext();
42737  return 0;
42738 }
42739 
42740 
42741 #if PY_MAJOR_VERSION < 3
42742 #ifdef CYTHON_NO_PYINIT_EXPORT
42743 #define __Pyx_PyMODINIT_FUNC void
42744 #else
42745 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
42746 #endif
42747 #else
42748 #ifdef CYTHON_NO_PYINIT_EXPORT
42749 #define __Pyx_PyMODINIT_FUNC PyObject *
42750 #else
42751 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
42752 #endif
42753 #endif
42754 
42755 
42756 #if PY_MAJOR_VERSION < 3
42757 __Pyx_PyMODINIT_FUNC initMeshSmoothing(void) CYTHON_SMALL_CODE; /*proto*/
42758 __Pyx_PyMODINIT_FUNC initMeshSmoothing(void)
42759 #else
42760 __Pyx_PyMODINIT_FUNC PyInit_MeshSmoothing(void) CYTHON_SMALL_CODE; /*proto*/
42761 __Pyx_PyMODINIT_FUNC PyInit_MeshSmoothing(void)
42762 #if CYTHON_PEP489_MULTI_PHASE_INIT
42763 {
42764  return PyModuleDef_Init(&__pyx_moduledef);
42765 }
42766 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
42767  #if PY_VERSION_HEX >= 0x030700A1
42768  static PY_INT64_T main_interpreter_id = -1;
42769  PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
42770  if (main_interpreter_id == -1) {
42771  main_interpreter_id = current_id;
42772  return (unlikely(current_id == -1)) ? -1 : 0;
42773  } else if (unlikely(main_interpreter_id != current_id))
42774  #else
42775  static PyInterpreterState *main_interpreter = NULL;
42776  PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
42777  if (!main_interpreter) {
42778  main_interpreter = current_interpreter;
42779  } else if (unlikely(main_interpreter != current_interpreter))
42780  #endif
42781  {
42782  PyErr_SetString(
42783  PyExc_ImportError,
42784  "Interpreter change detected - this module can only be loaded into one interpreter per process.");
42785  return -1;
42786  }
42787  return 0;
42788 }
42789 static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
42790  PyObject *value = PyObject_GetAttrString(spec, from_name);
42791  int result = 0;
42792  if (likely(value)) {
42793  if (allow_none || value != Py_None) {
42794  result = PyDict_SetItemString(moddict, to_name, value);
42795  }
42796  Py_DECREF(value);
42797  } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
42798  PyErr_Clear();
42799  } else {
42800  result = -1;
42801  }
42802  return result;
42803 }
42804 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
42805  PyObject *module = NULL, *moddict, *modname;
42806  if (__Pyx_check_single_interpreter())
42807  return NULL;
42808  if (__pyx_m)
42809  return __Pyx_NewRef(__pyx_m);
42810  modname = PyObject_GetAttrString(spec, "name");
42811  if (unlikely(!modname)) goto bad;
42812  module = PyModule_NewObject(modname);
42813  Py_DECREF(modname);
42814  if (unlikely(!module)) goto bad;
42815  moddict = PyModule_GetDict(module);
42816  if (unlikely(!moddict)) goto bad;
42817  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
42818  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
42819  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
42820  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
42821  return module;
42822 bad:
42823  Py_XDECREF(module);
42824  return NULL;
42825 }
42826 
42827 
42828 static CYTHON_SMALL_CODE int __pyx_pymod_exec_MeshSmoothing(PyObject *__pyx_pyinit_module)
42829 #endif
42830 #endif
42831 {
42832  PyObject *__pyx_t_1 = NULL;
42833  PyObject *__pyx_t_2 = NULL;
42834  __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
42835  static PyThread_type_lock __pyx_t_4[8];
42836  __Pyx_RefNannyDeclarations
42837  #if CYTHON_PEP489_MULTI_PHASE_INIT
42838  if (__pyx_m) {
42839  if (__pyx_m == __pyx_pyinit_module) return 0;
42840  PyErr_SetString(PyExc_RuntimeError, "Module 'MeshSmoothing' has already been imported. Re-initialisation is not supported.");
42841  return -1;
42842  }
42843  #elif PY_MAJOR_VERSION >= 3
42844  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
42845  #endif
42846  #if CYTHON_REFNANNY
42847 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
42848 if (!__Pyx_RefNanny) {
42849  PyErr_Clear();
42850  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
42851  if (!__Pyx_RefNanny)
42852  Py_FatalError("failed to import 'refnanny' module");
42853 }
42854 #endif
42855  __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_MeshSmoothing(void)", 0);
42856  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42857  #ifdef __Pxy_PyFrame_Initialize_Offsets
42858  __Pxy_PyFrame_Initialize_Offsets();
42859  #endif
42860  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
42861  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
42862  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
42863  #ifdef __Pyx_CyFunction_USED
42864  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42865  #endif
42866  #ifdef __Pyx_FusedFunction_USED
42867  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42868  #endif
42869  #ifdef __Pyx_Coroutine_USED
42870  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42871  #endif
42872  #ifdef __Pyx_Generator_USED
42873  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42874  #endif
42875  #ifdef __Pyx_AsyncGen_USED
42876  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42877  #endif
42878  #ifdef __Pyx_StopAsyncIteration_USED
42879  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42880  #endif
42881  /*--- Library function declarations ---*/
42882  /*--- Threads initialization code ---*/
42883  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
42884  #ifdef WITH_THREAD /* Python build with threading support? */
42885  PyEval_InitThreads();
42886  #endif
42887  #endif
42888  /*--- Module creation code ---*/
42889  #if CYTHON_PEP489_MULTI_PHASE_INIT
42890  __pyx_m = __pyx_pyinit_module;
42891  Py_INCREF(__pyx_m);
42892  #else
42893  #if PY_MAJOR_VERSION < 3
42894  __pyx_m = Py_InitModule4("MeshSmoothing", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
42895  #else
42896  __pyx_m = PyModule_Create(&__pyx_moduledef);
42897  #endif
42898  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
42899  #endif
42900  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
42901  Py_INCREF(__pyx_d);
42902  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
42903  Py_INCREF(__pyx_b);
42904  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
42905  Py_INCREF(__pyx_cython_runtime);
42906  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
42907  /*--- Initialize various global constants etc. ---*/
42908  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42909  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
42910  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42911  #endif
42912  if (__pyx_module_is_main_mprans__MeshSmoothing) {
42913  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42914  }
42915  #if PY_MAJOR_VERSION >= 3
42916  {
42917  PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
42918  if (!PyDict_GetItemString(modules, "mprans.MeshSmoothing")) {
42919  if (unlikely(PyDict_SetItemString(modules, "mprans.MeshSmoothing", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
42920  }
42921  }
42922  #endif
42923  /*--- Builtin init code ---*/
42924  if (__Pyx_InitCachedBuiltins() < 0) goto __pyx_L1_error;
42925  /*--- Constants init code ---*/
42926  if (__Pyx_InitCachedConstants() < 0) goto __pyx_L1_error;
42927  /*--- Global type/function init code ---*/
42928  (void)__Pyx_modinit_global_init_code();
42929  (void)__Pyx_modinit_variable_export_code();
42930  if (unlikely(__Pyx_modinit_function_export_code() != 0)) goto __pyx_L1_error;
42931  if (unlikely(__Pyx_modinit_type_init_code() != 0)) goto __pyx_L1_error;
42932  if (unlikely(__Pyx_modinit_type_import_code() != 0)) goto __pyx_L1_error;
42933  (void)__Pyx_modinit_variable_import_code();
42934  (void)__Pyx_modinit_function_import_code();
42935  /*--- Execution code ---*/
42936  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
42937  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
42938  #endif
42939 
42940  /* "mprans/MeshSmoothing.pyx":4
42941  * #cython: wraparound=True, boundscheck=False, initializedcheck=False, cdivision=True
42942  *
42943  * import numpy as np # <<<<<<<<<<<<<<
42944  * cimport numpy as np
42945  * from libcpp cimport bool
42946  */
42947  __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error)
42948  __Pyx_GOTREF(__pyx_t_1);
42949  if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 4, __pyx_L1_error)
42950  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
42951 
42952  /* "mprans/MeshSmoothing.pyx":8
42953  * from libcpp cimport bool
42954  * from libc.math cimport sin, cos, acos, exp, sqrt, fabs, M_PI, abs
42955  * from mpi4py import MPI # <<<<<<<<<<<<<<
42956  * from proteus.Profiling import logEvent
42957  *
42958  */
42959  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
42960  __Pyx_GOTREF(__pyx_t_1);
42961  __Pyx_INCREF(__pyx_n_s_MPI);
42962  __Pyx_GIVEREF(__pyx_n_s_MPI);
42963  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_MPI);
42964  __pyx_t_2 = __Pyx_Import(__pyx_n_s_mpi4py, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __pyx_L1_error)
42965  __Pyx_GOTREF(__pyx_t_2);
42966  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
42967  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_MPI); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
42968  __Pyx_GOTREF(__pyx_t_1);
42969  if (PyDict_SetItem(__pyx_d, __pyx_n_s_MPI, __pyx_t_1) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
42970  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
42971  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
42972 
42973  /* "mprans/MeshSmoothing.pyx":9
42974  * from libc.math cimport sin, cos, acos, exp, sqrt, fabs, M_PI, abs
42975  * from mpi4py import MPI
42976  * from proteus.Profiling import logEvent # <<<<<<<<<<<<<<
42977  *
42978  * def smoothNodesLaplace(double[:,:] nodeArray_,
42979  */
42980  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error)
42981  __Pyx_GOTREF(__pyx_t_2);
42982  __Pyx_INCREF(__pyx_n_s_logEvent);
42983  __Pyx_GIVEREF(__pyx_n_s_logEvent);
42984  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_logEvent);
42985  __pyx_t_1 = __Pyx_Import(__pyx_n_s_proteus_Profiling, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error)
42986  __Pyx_GOTREF(__pyx_t_1);
42987  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
42988  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_logEvent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error)
42989  __Pyx_GOTREF(__pyx_t_2);
42990  if (PyDict_SetItem(__pyx_d, __pyx_n_s_logEvent, __pyx_t_2) < 0) __PYX_ERR(0, 9, __pyx_L1_error)
42991  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
42992  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
42993 
42994  /* "mprans/MeshSmoothing.pyx":19
42995  * bool simultaneous=False,
42996  * bool smoothBoundaries=True,
42997  * int[:] fixedNodesBoolArray=None, # <<<<<<<<<<<<<<
42998  * double alpha=0.):
42999  * """
43000  */
43001  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 19, __pyx_L1_error)
43002  __pyx_k_ = __pyx_t_3;
43003  __pyx_t_3.memview = NULL;
43004  __pyx_t_3.data = NULL;
43005 
43006  /* "mprans/MeshSmoothing.pyx":11
43007  * from proteus.Profiling import logEvent
43008  *
43009  * def smoothNodesLaplace(double[:,:] nodeArray_, # <<<<<<<<<<<<<<
43010  * int[:] nodeStarOffsets,
43011  * int[:] nodeStarArray,
43012  */
43013  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_1smoothNodesLaplace, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error)
43014  __Pyx_GOTREF(__pyx_t_1);
43015  if (PyDict_SetItem(__pyx_d, __pyx_n_s_smoothNodesLaplace, __pyx_t_1) < 0) __PYX_ERR(0, 11, __pyx_L1_error)
43016  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43017 
43018  /* "mprans/MeshSmoothing.pyx":74
43019  * bool simultaneous=True,
43020  * bool smoothBoundaries=True,
43021  * int[:] fixedNodesBoolArray=None, # <<<<<<<<<<<<<<
43022  * double alpha=0.):
43023  * """
43024  */
43025  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 74, __pyx_L1_error)
43026  __pyx_k__2 = __pyx_t_3;
43027  __pyx_t_3.memview = NULL;
43028  __pyx_t_3.data = NULL;
43029 
43030  /* "mprans/MeshSmoothing.pyx":64
43031  * alpha=alpha)
43032  *
43033  * def smoothNodesCentroid(double[:,:] nodeArray_, # <<<<<<<<<<<<<<
43034  * int[:] nodeElementOffsets,
43035  * int[:] nodeElementsArray,
43036  */
43037  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_3smoothNodesCentroid, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error)
43038  __Pyx_GOTREF(__pyx_t_1);
43039  if (PyDict_SetItem(__pyx_d, __pyx_n_s_smoothNodesCentroid, __pyx_t_1) < 0) __PYX_ERR(0, 64, __pyx_L1_error)
43040  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43041 
43042  /* "mprans/MeshSmoothing.pyx":127
43043  * alpha=alpha)
43044  *
43045  * def updateDilationElements(double[:] elementDilationArray_, # <<<<<<<<<<<<<<
43046  * double[:] elementVolumeArray,
43047  * double[:] elementVolumeTargetArray,
43048  */
43049  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_5updateDilationElements, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error)
43050  __Pyx_GOTREF(__pyx_t_1);
43051  if (PyDict_SetItem(__pyx_d, __pyx_n_s_updateDilationElements, __pyx_t_1) < 0) __PYX_ERR(0, 127, __pyx_L1_error)
43052  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43053 
43054  /* "mprans/MeshSmoothing.pyx":136
43055  * nElements=nElements)
43056  *
43057  * def getDilationElements(double[:] elementVolumeArray, # <<<<<<<<<<<<<<
43058  * double[:] elementVolumeTargetArray):
43059  * cdef int nElements = len(elementVolumeArray)
43060  */
43061  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_7getDilationElements, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 136, __pyx_L1_error)
43062  __Pyx_GOTREF(__pyx_t_1);
43063  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getDilationElements, __pyx_t_1) < 0) __PYX_ERR(0, 136, __pyx_L1_error)
43064  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43065 
43066  /* "mprans/MeshSmoothing.pyx":146
43067  * return elementDilationArray_
43068  *
43069  * def updateDistortionElements(double[:] elementDistortionArray_, # <<<<<<<<<<<<<<
43070  * double[:,:,:,:] J_array,
43071  * double[:,:] detJ_array,
43072  */
43073  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_9updateDistortionElements, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error)
43074  __Pyx_GOTREF(__pyx_t_1);
43075  if (PyDict_SetItem(__pyx_d, __pyx_n_s_updateDistortionElements, __pyx_t_1) < 0) __PYX_ERR(0, 146, __pyx_L1_error)
43076  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43077 
43078  /* "mprans/MeshSmoothing.pyx":157
43079  * nElements=nElements)
43080  *
43081  * def getDistortionElements(double[:,:,:,:] J_array, # <<<<<<<<<<<<<<
43082  * double[:,:] detJ_array,
43083  * int nd):
43084  */
43085  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_11getDistortionElements, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 157, __pyx_L1_error)
43086  __Pyx_GOTREF(__pyx_t_1);
43087  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getDistortionElements, __pyx_t_1) < 0) __PYX_ERR(0, 157, __pyx_L1_error)
43088  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43089 
43090  /* "mprans/MeshSmoothing.pyx":169
43091  * return elementDistortionArray_
43092  *
43093  * def updateInverseMeanRatioTriangleElements(double[:] IMRElementsArray_, # <<<<<<<<<<<<<<
43094  * double[:,:] nodeArray,
43095  * int[:,:] elementNodesArray,
43096  */
43097  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_13updateInverseMeanRatioTriangleElements, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 169, __pyx_L1_error)
43098  __Pyx_GOTREF(__pyx_t_1);
43099  if (PyDict_SetItem(__pyx_d, __pyx_n_s_updateInverseMeanRatioTriangleEl, __pyx_t_1) < 0) __PYX_ERR(0, 169, __pyx_L1_error)
43100  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43101 
43102  /* "mprans/MeshSmoothing.pyx":178
43103  * nElements=nElements)
43104  *
43105  * def getInverseMeanRatioTriangleElements(double[:,:] nodeArray, # <<<<<<<<<<<<<<
43106  * int[:,:] elementNodesArray):
43107  * cdef int nElements = len(elementNodesArray)
43108  */
43109  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_15getInverseMeanRatioTriangleElements, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error)
43110  __Pyx_GOTREF(__pyx_t_1);
43111  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getInverseMeanRatioTriangleEleme, __pyx_t_1) < 0) __PYX_ERR(0, 178, __pyx_L1_error)
43112  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43113 
43114  /* "mprans/MeshSmoothing.pyx":188
43115  * return IMRElementsArray_
43116  *
43117  * def updateInverseMeanRatioTriangleNodes(double[:] IMRNodesArray_, # <<<<<<<<<<<<<<
43118  * double[:,:] nodeArray,
43119  * int[:,:] elementNodesArray,
43120  */
43121  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_17updateInverseMeanRatioTriangleNodes, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 188, __pyx_L1_error)
43122  __Pyx_GOTREF(__pyx_t_1);
43123  if (PyDict_SetItem(__pyx_d, __pyx_n_s_updateInverseMeanRatioTriangleNo, __pyx_t_1) < 0) __PYX_ERR(0, 188, __pyx_L1_error)
43124  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43125 
43126  /* "mprans/MeshSmoothing.pyx":205
43127  * nElements=nElements)
43128  *
43129  * def getInverseMeanRatioTriangleNodes(double[:,:] nodeArray, # <<<<<<<<<<<<<<
43130  * int[:,:] elementNodesArray,
43131  * int[:] nodeElementOffsets,
43132  */
43133  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_19getInverseMeanRatioTriangleNodes, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error)
43134  __Pyx_GOTREF(__pyx_t_1);
43135  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getInverseMeanRatioTriangleNodes, __pyx_t_1) < 0) __PYX_ERR(0, 205, __pyx_L1_error)
43136  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43137 
43138  /* "mprans/MeshSmoothing.pyx":223
43139  * return IMRNodesArray_
43140  *
43141  * def getInverseMeanRatioSingleTriangle(int node0, # <<<<<<<<<<<<<<
43142  * double[:,:] nodeArray,
43143  * int[:,:] elementNodesArray,
43144  */
43145  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_21getInverseMeanRatioSingleTriangle, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 223, __pyx_L1_error)
43146  __Pyx_GOTREF(__pyx_t_1);
43147  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getInverseMeanRatioSingleTriangl, __pyx_t_1) < 0) __PYX_ERR(0, 223, __pyx_L1_error)
43148  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43149 
43150  /* "mprans/MeshSmoothing.pyx":234
43151  * nodeElementsArray=nodeElementsArray)
43152  *
43153  * def smoothNodesQuality(double[:] distortion, # <<<<<<<<<<<<<<
43154  * double[:] dilation,
43155  * double[:,:] nodeArray,
43156  */
43157  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_23smoothNodesQuality, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error)
43158  __Pyx_GOTREF(__pyx_t_1);
43159  if (PyDict_SetItem(__pyx_d, __pyx_n_s_smoothNodesQuality, __pyx_t_1) < 0) __PYX_ERR(0, 234, __pyx_L1_error)
43160  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43161 
43162  /* "mprans/MeshSmoothing.pyx":254
43163  * apply_directly=False)
43164  *
43165  * def getLocalNearestNode(double[:] coords, # <<<<<<<<<<<<<<
43166  * double[:,:] nodeArray,
43167  * int[:] nodeStarOffsets,
43168  */
43169  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_25getLocalNearestNode, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 254, __pyx_L1_error)
43170  __Pyx_GOTREF(__pyx_t_1);
43171  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getLocalNearestNode, __pyx_t_1) < 0) __PYX_ERR(0, 254, __pyx_L1_error)
43172  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43173 
43174  /* "mprans/MeshSmoothing.pyx":285
43175  * node)
43176  *
43177  * def getLocalNearestElement(double[:] coords, # <<<<<<<<<<<<<<
43178  * double[:,:] elementBarycentersArray,
43179  * int[:,:] elementNeighborsArray,
43180  */
43181  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_27getLocalNearestElement, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 285, __pyx_L1_error)
43182  __Pyx_GOTREF(__pyx_t_1);
43183  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getLocalNearestElement, __pyx_t_1) < 0) __PYX_ERR(0, 285, __pyx_L1_error)
43184  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43185 
43186  /* "mprans/MeshSmoothing.pyx":312
43187  * eN)
43188  *
43189  * def getLocalNearestElementAroundNode(double[:] coords, # <<<<<<<<<<<<<<
43190  * int[:] nodeElementOffsets,
43191  * int[:] nodeElementsArray,
43192  */
43193  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_29getLocalNearestElementAroundNode, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 312, __pyx_L1_error)
43194  __Pyx_GOTREF(__pyx_t_1);
43195  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getLocalNearestElementAroundNode, __pyx_t_1) < 0) __PYX_ERR(0, 312, __pyx_L1_error)
43196  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43197 
43198  /* "mprans/MeshSmoothing.pyx":343
43199  * node=node)
43200  *
43201  * def getLocalNearestElementIntersection(double[:] coords, # <<<<<<<<<<<<<<
43202  * double[:] starting_coords,
43203  * double[:,:,:] elementBoundaryNormalsArray,
43204  */
43205  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_31getLocalNearestElementIntersection, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 343, __pyx_L1_error)
43206  __Pyx_GOTREF(__pyx_t_1);
43207  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getLocalNearestElementIntersecti, __pyx_t_1) < 0) __PYX_ERR(0, 343, __pyx_L1_error)
43208  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43209 
43210  /* "mprans/MeshSmoothing.pyx":388
43211  * eN=eN)
43212  *
43213  * def getLocalElement(femSpace, # <<<<<<<<<<<<<<
43214  * coords,
43215  * node):
43216  */
43217  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_33getLocalElement, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 388, __pyx_L1_error)
43218  __Pyx_GOTREF(__pyx_t_1);
43219  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getLocalElement, __pyx_t_1) < 0) __PYX_ERR(0, 388, __pyx_L1_error)
43220  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43221 
43222  /* "mprans/MeshSmoothing.pyx":452
43223  *
43224  *
43225  * def updateElementBoundaryNormalsTriangle(double[:,:,:] elementBoundaryNormalsArray_, # <<<<<<<<<<<<<<
43226  * double[:,:] nodeArray,
43227  * int[:,:] elementBoundariesArray,
43228  */
43229  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_35updateElementBoundaryNormalsTriangle, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 452, __pyx_L1_error)
43230  __Pyx_GOTREF(__pyx_t_1);
43231  if (PyDict_SetItem(__pyx_d, __pyx_n_s_updateElementBoundaryNormalsTria, __pyx_t_1) < 0) __PYX_ERR(0, 452, __pyx_L1_error)
43232  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43233 
43234  /* "mprans/MeshSmoothing.pyx":467
43235  * nElements=nElements)
43236  *
43237  * def getElementBoundaryNormalsTriangle(double[:,:] nodeArray, # <<<<<<<<<<<<<<
43238  * int[:,:] elementBoundariesArray,
43239  * int[:,:] elementBoundaryNodesArray,
43240  */
43241  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_37getElementBoundaryNormalsTriangle, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 467, __pyx_L1_error)
43242  __Pyx_GOTREF(__pyx_t_1);
43243  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getElementBoundaryNormalsTriangl, __pyx_t_1) < 0) __PYX_ERR(0, 467, __pyx_L1_error)
43244  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43245 
43246  /* "mprans/MeshSmoothing.pyx":483
43247  * return elementBoundaryNormalsArray_
43248  *
43249  * def updateElementBoundaryNormalsTetra(double[:,:,:] elementBoundaryNormalsArray_, # <<<<<<<<<<<<<<
43250  * double[:,:] nodeArray,
43251  * int[:,:] elementBoundariesArray,
43252  */
43253  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_39updateElementBoundaryNormalsTetra, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 483, __pyx_L1_error)
43254  __Pyx_GOTREF(__pyx_t_1);
43255  if (PyDict_SetItem(__pyx_d, __pyx_n_s_updateElementBoundaryNormalsTetr, __pyx_t_1) < 0) __PYX_ERR(0, 483, __pyx_L1_error)
43256  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43257 
43258  /* "mprans/MeshSmoothing.pyx":498
43259  * nElements=nElements)
43260  *
43261  * def getElementBoundaryNormalsTetra(double[:,:] nodeArray, # <<<<<<<<<<<<<<
43262  * int[:,:] elementBoundariesArray,
43263  * int[:,:] elementBoundaryNodesArray,
43264  */
43265  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_41getElementBoundaryNormalsTetra, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 498, __pyx_L1_error)
43266  __Pyx_GOTREF(__pyx_t_1);
43267  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getElementBoundaryNormalsTetra, __pyx_t_1) < 0) __PYX_ERR(0, 498, __pyx_L1_error)
43268  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43269 
43270  /* "mprans/MeshSmoothing.pyx":514
43271  * return elementBoundaryNormalsArray_
43272  *
43273  * def updateElementVolumesTriangle(double[:] elementVolumesArray_, # <<<<<<<<<<<<<<
43274  * int[:,:] elementNodesArray,
43275  * double[:,:] nodeArray,
43276  */
43277  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_43updateElementVolumesTriangle, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 514, __pyx_L1_error)
43278  __Pyx_GOTREF(__pyx_t_1);
43279  if (PyDict_SetItem(__pyx_d, __pyx_n_s_updateElementVolumesTriangle, __pyx_t_1) < 0) __PYX_ERR(0, 514, __pyx_L1_error)
43280  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43281 
43282  /* "mprans/MeshSmoothing.pyx":523
43283  * nElements=nElements)
43284  *
43285  * def getElementVolumeTriangle(double[:] nA, # <<<<<<<<<<<<<<
43286  * double[:] nB,
43287  * double[:] nC):
43288  */
43289  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_45getElementVolumeTriangle, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 523, __pyx_L1_error)
43290  __Pyx_GOTREF(__pyx_t_1);
43291  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getElementVolumeTriangle, __pyx_t_1) < 0) __PYX_ERR(0, 523, __pyx_L1_error)
43292  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43293 
43294  /* "mprans/MeshSmoothing.pyx":530
43295  * nC=nC)
43296  *
43297  * def updateElementVolumesTetra(double[:] elementVolumesArray_, # <<<<<<<<<<<<<<
43298  * int[:,:] elementNodesArray,
43299  * double[:,:] nodeArray,
43300  */
43301  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_47updateElementVolumesTetra, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error)
43302  __Pyx_GOTREF(__pyx_t_1);
43303  if (PyDict_SetItem(__pyx_d, __pyx_n_s_updateElementVolumesTetra, __pyx_t_1) < 0) __PYX_ERR(0, 530, __pyx_L1_error)
43304  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43305 
43306  /* "mprans/MeshSmoothing.pyx":539
43307  * nElements=nElements)
43308  *
43309  * def updateElementBarycenters(double[:,:] elementBarycentersArray_, # <<<<<<<<<<<<<<
43310  * int[:,:] elementNodesArray,
43311  * double[:,:] nodeArray,
43312  */
43313  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_49updateElementBarycenters, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 539, __pyx_L1_error)
43314  __Pyx_GOTREF(__pyx_t_1);
43315  if (PyDict_SetItem(__pyx_d, __pyx_n_s_updateElementBarycenters, __pyx_t_1) < 0) __PYX_ERR(0, 539, __pyx_L1_error)
43316  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43317 
43318  /* "mprans/MeshSmoothing.pyx":548
43319  * nElements=nElements)
43320  *
43321  * def getCornerNodesTriangle(double[:,:] nodeArray, # <<<<<<<<<<<<<<
43322  * int[:] nodeStarArray,
43323  * int[:] nodeStarOffsets,
43324  */
43325  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_51getCornerNodesTriangle, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 548, __pyx_L1_error)
43326  __Pyx_GOTREF(__pyx_t_1);
43327  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getCornerNodesTriangle, __pyx_t_1) < 0) __PYX_ERR(0, 548, __pyx_L1_error)
43328  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43329 
43330  /* "mprans/MeshSmoothing.pyx":559
43331  * nNodes=nNodes)
43332  *
43333  * def getNonOwnedNodeValues(args_, # <<<<<<<<<<<<<<
43334  * int nNodes_owned,
43335  * int nNodes_global,
43336  */
43337  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_53getNonOwnedNodeValues, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 559, __pyx_L1_error)
43338  __Pyx_GOTREF(__pyx_t_1);
43339  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getNonOwnedNodeValues, __pyx_t_1) < 0) __PYX_ERR(0, 559, __pyx_L1_error)
43340  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43341 
43342  /* "mprans/MeshSmoothing.pyx":690
43343  * # nproc=str(comm_size)))
43344  *
43345  * def checkOwnedVariable(int variable_nb_local, # <<<<<<<<<<<<<<
43346  * int rank,
43347  * int nVariables_owned,
43348  */
43349  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_55checkOwnedVariable, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 690, __pyx_L1_error)
43350  __Pyx_GOTREF(__pyx_t_1);
43351  if (PyDict_SetItem(__pyx_d, __pyx_n_s_checkOwnedVariable, __pyx_t_1) < 0) __PYX_ERR(0, 690, __pyx_L1_error)
43352  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43353 
43354  /* "mprans/MeshSmoothing.pyx":701
43355  * variableOffsets_subdomain_owned=variableOffsets_subdomain_owned)
43356  *
43357  * def pyScalarRecoveryAtNodes(double[:] scalars, # <<<<<<<<<<<<<<
43358  * int[:] nodeElementsArray,
43359  * int[:] nodeElementOffsets):
43360  */
43361  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_57pyScalarRecoveryAtNodes, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 701, __pyx_L1_error)
43362  __Pyx_GOTREF(__pyx_t_1);
43363  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyScalarRecoveryAtNodes, __pyx_t_1) < 0) __PYX_ERR(0, 701, __pyx_L1_error)
43364  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43365 
43366  /* "mprans/MeshSmoothing.pyx":708
43367  * nodeElementOffsets=nodeElementOffsets)
43368  *
43369  * def pyScalarRecoveryAtNodesWeighted(double[:] scalars, # <<<<<<<<<<<<<<
43370  * int[:] nodeElementsArray,
43371  * int[:] nodeElementOffsets,
43372  */
43373  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_59pyScalarRecoveryAtNodesWeighted, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 708, __pyx_L1_error)
43374  __Pyx_GOTREF(__pyx_t_1);
43375  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyScalarRecoveryAtNodesWeighted, __pyx_t_1) < 0) __PYX_ERR(0, 708, __pyx_L1_error)
43376  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43377 
43378  /* "mprans/MeshSmoothing.pyx":719
43379  * nNodes=nNodes)
43380  *
43381  * def pyVectorRecoveryAtNodes(vectors, # <<<<<<<<<<<<<<
43382  * nodeElementsArray,
43383  * nodeElementOffsets,
43384  */
43385  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_61pyVectorRecoveryAtNodes, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 719, __pyx_L1_error)
43386  __Pyx_GOTREF(__pyx_t_1);
43387  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyVectorRecoveryAtNodes, __pyx_t_1) < 0) __PYX_ERR(0, 719, __pyx_L1_error)
43388  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43389 
43390  /* "mprans/MeshSmoothing.pyx":728
43391  * nd=nd)
43392  *
43393  * def pyVectorRecoveryAtNodesWeighted(double[:,:] vectors, # <<<<<<<<<<<<<<
43394  * int[:] nodeElementsArray,
43395  * int[:] nodeElementOffsets,
43396  */
43397  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_63pyVectorRecoveryAtNodesWeighted, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 728, __pyx_L1_error)
43398  __Pyx_GOTREF(__pyx_t_1);
43399  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyVectorRecoveryAtNodesWeighted, __pyx_t_1) < 0) __PYX_ERR(0, 728, __pyx_L1_error)
43400  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43401 
43402  /* "mprans/MeshSmoothing.pyx":749
43403  * bool simultaneous=False,
43404  * bool smoothBoundaries=True,
43405  * int[:] fixedNodesBoolArray=None, # <<<<<<<<<<<<<<
43406  * double alpha=0.):
43407  * cdef double[:,:] nodeArray0
43408  */
43409  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 749, __pyx_L1_error)
43410  __pyx_k__5 = __pyx_t_3;
43411  __pyx_t_3.memview = NULL;
43412  __pyx_t_3.data = NULL;
43413 
43414  /* "mprans/MeshSmoothing.pyx":1
43415  * #!python # <<<<<<<<<<<<<<
43416  * #cython: wraparound=True, boundscheck=False, initializedcheck=False, cdivision=True
43417  *
43418  */
43419  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
43420  __Pyx_GOTREF(__pyx_t_1);
43421  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
43422  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43423 
43424  /* "View.MemoryView":209
43425  * info.obj = self
43426  *
43427  * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<<
43428  *
43429  * def __dealloc__(array self):
43430  */
43431  __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 209, __pyx_L1_error)
43432  __Pyx_GOTREF(__pyx_t_1);
43433  if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 209, __pyx_L1_error)
43434  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43435  PyType_Modified(__pyx_array_type);
43436 
43437  /* "View.MemoryView":286
43438  * return self.name
43439  *
43440  * cdef generic = Enum("<strided and direct or indirect>") # <<<<<<<<<<<<<<
43441  * cdef strided = Enum("<strided and direct>") # default
43442  * cdef indirect = Enum("<strided and indirect>")
43443  */
43444  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__100, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 286, __pyx_L1_error)
43445  __Pyx_GOTREF(__pyx_t_1);
43446  __Pyx_XGOTREF(generic);
43447  __Pyx_DECREF_SET(generic, __pyx_t_1);
43448  __Pyx_GIVEREF(__pyx_t_1);
43449  __pyx_t_1 = 0;
43450 
43451  /* "View.MemoryView":287
43452  *
43453  * cdef generic = Enum("<strided and direct or indirect>")
43454  * cdef strided = Enum("<strided and direct>") # default # <<<<<<<<<<<<<<
43455  * cdef indirect = Enum("<strided and indirect>")
43456  *
43457  */
43458  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__101, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 287, __pyx_L1_error)
43459  __Pyx_GOTREF(__pyx_t_1);
43460  __Pyx_XGOTREF(strided);
43461  __Pyx_DECREF_SET(strided, __pyx_t_1);
43462  __Pyx_GIVEREF(__pyx_t_1);
43463  __pyx_t_1 = 0;
43464 
43465  /* "View.MemoryView":288
43466  * cdef generic = Enum("<strided and direct or indirect>")
43467  * cdef strided = Enum("<strided and direct>") # default
43468  * cdef indirect = Enum("<strided and indirect>") # <<<<<<<<<<<<<<
43469  *
43470  *
43471  */
43472  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__102, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 288, __pyx_L1_error)
43473  __Pyx_GOTREF(__pyx_t_1);
43474  __Pyx_XGOTREF(indirect);
43475  __Pyx_DECREF_SET(indirect, __pyx_t_1);
43476  __Pyx_GIVEREF(__pyx_t_1);
43477  __pyx_t_1 = 0;
43478 
43479  /* "View.MemoryView":291
43480  *
43481  *
43482  * cdef contiguous = Enum("<contiguous and direct>") # <<<<<<<<<<<<<<
43483  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
43484  *
43485  */
43486  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__103, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 291, __pyx_L1_error)
43487  __Pyx_GOTREF(__pyx_t_1);
43488  __Pyx_XGOTREF(contiguous);
43489  __Pyx_DECREF_SET(contiguous, __pyx_t_1);
43490  __Pyx_GIVEREF(__pyx_t_1);
43491  __pyx_t_1 = 0;
43492 
43493  /* "View.MemoryView":292
43494  *
43495  * cdef contiguous = Enum("<contiguous and direct>")
43496  * cdef indirect_contiguous = Enum("<contiguous and indirect>") # <<<<<<<<<<<<<<
43497  *
43498  *
43499  */
43500  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__104, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 292, __pyx_L1_error)
43501  __Pyx_GOTREF(__pyx_t_1);
43502  __Pyx_XGOTREF(indirect_contiguous);
43503  __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1);
43504  __Pyx_GIVEREF(__pyx_t_1);
43505  __pyx_t_1 = 0;
43506 
43507  /* "View.MemoryView":316
43508  *
43509  * DEF THREAD_LOCKS_PREALLOCATED = 8
43510  * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<<
43511  * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [
43512  * PyThread_allocate_lock(),
43513  */
43514  __pyx_memoryview_thread_locks_used = 0;
43515 
43516  /* "View.MemoryView":317
43517  * DEF THREAD_LOCKS_PREALLOCATED = 8
43518  * cdef int __pyx_memoryview_thread_locks_used = 0
43519  * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<<
43520  * PyThread_allocate_lock(),
43521  * PyThread_allocate_lock(),
43522  */
43523  __pyx_t_4[0] = PyThread_allocate_lock();
43524  __pyx_t_4[1] = PyThread_allocate_lock();
43525  __pyx_t_4[2] = PyThread_allocate_lock();
43526  __pyx_t_4[3] = PyThread_allocate_lock();
43527  __pyx_t_4[4] = PyThread_allocate_lock();
43528  __pyx_t_4[5] = PyThread_allocate_lock();
43529  __pyx_t_4[6] = PyThread_allocate_lock();
43530  __pyx_t_4[7] = PyThread_allocate_lock();
43531  memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_4, sizeof(__pyx_memoryview_thread_locks[0]) * (8));
43532 
43533  /* "View.MemoryView":549
43534  * info.obj = self
43535  *
43536  * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<<
43537  *
43538  *
43539  */
43540  __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 549, __pyx_L1_error)
43541  __Pyx_GOTREF(__pyx_t_1);
43542  if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 549, __pyx_L1_error)
43543  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43544  PyType_Modified(__pyx_memoryview_type);
43545 
43546  /* "View.MemoryView":995
43547  * return self.from_object
43548  *
43549  * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<<
43550  *
43551  *
43552  */
43553  __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 995, __pyx_L1_error)
43554  __Pyx_GOTREF(__pyx_t_1);
43555  if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 995, __pyx_L1_error)
43556  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43557  PyType_Modified(__pyx_memoryviewslice_type);
43558 
43559  /* "(tree fragment)":1
43560  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
43561  * cdef object __pyx_PickleError
43562  * cdef object __pyx_result
43563  */
43564  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1, __pyx_L1_error)
43565  __Pyx_GOTREF(__pyx_t_1);
43566  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_1) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
43567  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43568 
43569  /* "BufferFormatFromTypeInfo":1463
43570  *
43571  * @cname('__pyx_format_from_typeinfo')
43572  * cdef bytes format_from_typeinfo(__Pyx_TypeInfo *type): # <<<<<<<<<<<<<<
43573  * cdef __Pyx_StructField *field
43574  * cdef __pyx_typeinfo_string fmt
43575  */
43576 
43577  /*--- Wrapped vars code ---*/
43578 
43579  goto __pyx_L0;
43580  __pyx_L1_error:;
43581  __Pyx_XDECREF(__pyx_t_1);
43582  __Pyx_XDECREF(__pyx_t_2);
43583  __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
43584  if (__pyx_m) {
43585  if (__pyx_d) {
43586  __Pyx_AddTraceback("init mprans.MeshSmoothing", __pyx_clineno, __pyx_lineno, __pyx_filename);
43587  }
43588  Py_CLEAR(__pyx_m);
43589  } else if (!PyErr_Occurred()) {
43590  PyErr_SetString(PyExc_ImportError, "init mprans.MeshSmoothing");
43591  }
43592  __pyx_L0:;
43593  __Pyx_RefNannyFinishContext();
43594  #if CYTHON_PEP489_MULTI_PHASE_INIT
43595  return (__pyx_m != NULL) ? 0 : -1;
43596  #elif PY_MAJOR_VERSION >= 3
43597  return __pyx_m;
43598  #else
43599  return;
43600  #endif
43601 }
43602 
43603 /* --- Runtime support code --- */
43604 /* Refnanny */
43605 #if CYTHON_REFNANNY
43606 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
43607  PyObject *m = NULL, *p = NULL;
43608  void *r = NULL;
43609  m = PyImport_ImportModule(modname);
43610  if (!m) goto end;
43611  p = PyObject_GetAttrString(m, "RefNannyAPI");
43612  if (!p) goto end;
43613  r = PyLong_AsVoidPtr(p);
43614 end:
43615  Py_XDECREF(p);
43616  Py_XDECREF(m);
43617  return (__Pyx_RefNannyAPIStruct *)r;
43618 }
43619 #endif
43620 
43621 /* PyObjectGetAttrStr */
43622 #if CYTHON_USE_TYPE_SLOTS
43623 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
43624  PyTypeObject* tp = Py_TYPE(obj);
43625  if (likely(tp->tp_getattro))
43626  return tp->tp_getattro(obj, attr_name);
43627 #if PY_MAJOR_VERSION < 3
43628  if (likely(tp->tp_getattr))
43629  return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
43630 #endif
43631  return PyObject_GetAttr(obj, attr_name);
43632 }
43633 #endif
43634 
43635 /* GetBuiltinName */
43636 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
43637  PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
43638  if (unlikely(!result)) {
43639  PyErr_Format(PyExc_NameError,
43640 #if PY_MAJOR_VERSION >= 3
43641  "name '%U' is not defined", name);
43642 #else
43643  "name '%.200s' is not defined", PyString_AS_STRING(name));
43644 #endif
43645  }
43646  return result;
43647 }
43648 
43649 /* RaiseArgTupleInvalid */
43650 static void __Pyx_RaiseArgtupleInvalid(
43651  const char* func_name,
43652  int exact,
43653  Py_ssize_t num_min,
43654  Py_ssize_t num_max,
43655  Py_ssize_t num_found)
43656 {
43657  Py_ssize_t num_expected;
43658  const char *more_or_less;
43659  if (num_found < num_min) {
43660  num_expected = num_min;
43661  more_or_less = "at least";
43662  } else {
43663  num_expected = num_max;
43664  more_or_less = "at most";
43665  }
43666  if (exact) {
43667  more_or_less = "exactly";
43668  }
43669  PyErr_Format(PyExc_TypeError,
43670  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
43671  func_name, more_or_less, num_expected,
43672  (num_expected == 1) ? "" : "s", num_found);
43673 }
43674 
43675 /* RaiseDoubleKeywords */
43676 static void __Pyx_RaiseDoubleKeywordsError(
43677  const char* func_name,
43678  PyObject* kw_name)
43679 {
43680  PyErr_Format(PyExc_TypeError,
43681  #if PY_MAJOR_VERSION >= 3
43682  "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
43683  #else
43684  "%s() got multiple values for keyword argument '%s'", func_name,
43685  PyString_AsString(kw_name));
43686  #endif
43687 }
43688 
43689 /* ParseKeywords */
43690 static int __Pyx_ParseOptionalKeywords(
43691  PyObject *kwds,
43692  PyObject **argnames[],
43693  PyObject *kwds2,
43694  PyObject *values[],
43695  Py_ssize_t num_pos_args,
43696  const char* function_name)
43697 {
43698  PyObject *key = 0, *value = 0;
43699  Py_ssize_t pos = 0;
43700  PyObject*** name;
43701  PyObject*** first_kw_arg = argnames + num_pos_args;
43702  while (PyDict_Next(kwds, &pos, &key, &value)) {
43703  name = first_kw_arg;
43704  while (*name && (**name != key)) name++;
43705  if (*name) {
43706  values[name-argnames] = value;
43707  continue;
43708  }
43709  name = first_kw_arg;
43710  #if PY_MAJOR_VERSION < 3
43711  if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
43712  while (*name) {
43713  if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
43714  && _PyString_Eq(**name, key)) {
43715  values[name-argnames] = value;
43716  break;
43717  }
43718  name++;
43719  }
43720  if (*name) continue;
43721  else {
43722  PyObject*** argname = argnames;
43723  while (argname != first_kw_arg) {
43724  if ((**argname == key) || (
43725  (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
43726  && _PyString_Eq(**argname, key))) {
43727  goto arg_passed_twice;
43728  }
43729  argname++;
43730  }
43731  }
43732  } else
43733  #endif
43734  if (likely(PyUnicode_Check(key))) {
43735  while (*name) {
43736  int cmp = (**name == key) ? 0 :
43737  #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
43738  (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
43739  #endif
43740  PyUnicode_Compare(**name, key);
43741  if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
43742  if (cmp == 0) {
43743  values[name-argnames] = value;
43744  break;
43745  }
43746  name++;
43747  }
43748  if (*name) continue;
43749  else {
43750  PyObject*** argname = argnames;
43751  while (argname != first_kw_arg) {
43752  int cmp = (**argname == key) ? 0 :
43753  #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
43754  (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
43755  #endif
43756  PyUnicode_Compare(**argname, key);
43757  if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
43758  if (cmp == 0) goto arg_passed_twice;
43759  argname++;
43760  }
43761  }
43762  } else
43763  goto invalid_keyword_type;
43764  if (kwds2) {
43765  if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
43766  } else {
43767  goto invalid_keyword;
43768  }
43769  }
43770  return 0;
43771 arg_passed_twice:
43772  __Pyx_RaiseDoubleKeywordsError(function_name, key);
43773  goto bad;
43774 invalid_keyword_type:
43775  PyErr_Format(PyExc_TypeError,
43776  "%.200s() keywords must be strings", function_name);
43777  goto bad;
43778 invalid_keyword:
43779  PyErr_Format(PyExc_TypeError,
43780  #if PY_MAJOR_VERSION < 3
43781  "%.200s() got an unexpected keyword argument '%.200s'",
43782  function_name, PyString_AsString(key));
43783  #else
43784  "%s() got an unexpected keyword argument '%U'",
43785  function_name, key);
43786  #endif
43787 bad:
43788  return -1;
43789 }
43790 
43791 /* MemviewSliceInit */
43792 static int
43793 __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
43794  int ndim,
43795  __Pyx_memviewslice *memviewslice,
43796  int memview_is_new_reference)
43797 {
43798  __Pyx_RefNannyDeclarations
43799  int i, retval=-1;
43800  Py_buffer *buf = &memview->view;
43801  __Pyx_RefNannySetupContext("init_memviewslice", 0);
43802  if (memviewslice->memview || memviewslice->data) {
43803  PyErr_SetString(PyExc_ValueError,
43804  "memviewslice is already initialized!");
43805  goto fail;
43806  }
43807  if (buf->strides) {
43808  for (i = 0; i < ndim; i++) {
43809  memviewslice->strides[i] = buf->strides[i];
43810  }
43811  } else {
43812  Py_ssize_t stride = buf->itemsize;
43813  for (i = ndim - 1; i >= 0; i--) {
43814  memviewslice->strides[i] = stride;
43815  stride *= buf->shape[i];
43816  }
43817  }
43818  for (i = 0; i < ndim; i++) {
43819  memviewslice->shape[i] = buf->shape[i];
43820  if (buf->suboffsets) {
43821  memviewslice->suboffsets[i] = buf->suboffsets[i];
43822  } else {
43823  memviewslice->suboffsets[i] = -1;
43824  }
43825  }
43826  memviewslice->memview = memview;
43827  memviewslice->data = (char *)buf->buf;
43828  if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
43829  Py_INCREF(memview);
43830  }
43831  retval = 0;
43832  goto no_fail;
43833 fail:
43834  memviewslice->memview = 0;
43835  memviewslice->data = 0;
43836  retval = -1;
43837 no_fail:
43838  __Pyx_RefNannyFinishContext();
43839  return retval;
43840 }
43841 #ifndef Py_NO_RETURN
43842 #define Py_NO_RETURN
43843 #endif
43844 static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN {
43845  va_list vargs;
43846  char msg[200];
43847 #ifdef HAVE_STDARG_PROTOTYPES
43848  va_start(vargs, fmt);
43849 #else
43850  va_start(vargs);
43851 #endif
43852  vsnprintf(msg, 200, fmt, vargs);
43853  va_end(vargs);
43854  Py_FatalError(msg);
43855 }
43856 static CYTHON_INLINE int
43857 __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
43858  PyThread_type_lock lock)
43859 {
43860  int result;
43861  PyThread_acquire_lock(lock, 1);
43862  result = (*acquisition_count)++;
43863  PyThread_release_lock(lock);
43864  return result;
43865 }
43866 static CYTHON_INLINE int
43867 __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
43868  PyThread_type_lock lock)
43869 {
43870  int result;
43871  PyThread_acquire_lock(lock, 1);
43872  result = (*acquisition_count)--;
43873  PyThread_release_lock(lock);
43874  return result;
43875 }
43876 static CYTHON_INLINE void
43877 __Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno)
43878 {
43879  int first_time;
43880  struct __pyx_memoryview_obj *memview = memslice->memview;
43881  if (!memview || (PyObject *) memview == Py_None)
43882  return;
43883  if (__pyx_get_slice_count(memview) < 0)
43884  __pyx_fatalerror("Acquisition count is %d (line %d)",
43885  __pyx_get_slice_count(memview), lineno);
43886  first_time = __pyx_add_acquisition_count(memview) == 0;
43887  if (first_time) {
43888  if (have_gil) {
43889  Py_INCREF((PyObject *) memview);
43890  } else {
43891  PyGILState_STATE _gilstate = PyGILState_Ensure();
43892  Py_INCREF((PyObject *) memview);
43893  PyGILState_Release(_gilstate);
43894  }
43895  }
43896 }
43897 static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
43898  int have_gil, int lineno) {
43899  int last_time;
43900  struct __pyx_memoryview_obj *memview = memslice->memview;
43901  if (!memview ) {
43902  return;
43903  } else if ((PyObject *) memview == Py_None) {
43904  memslice->memview = NULL;
43905  return;
43906  }
43907  if (__pyx_get_slice_count(memview) <= 0)
43908  __pyx_fatalerror("Acquisition count is %d (line %d)",
43909  __pyx_get_slice_count(memview), lineno);
43910  last_time = __pyx_sub_acquisition_count(memview) == 1;
43911  memslice->data = NULL;
43912  if (last_time) {
43913  if (have_gil) {
43914  Py_CLEAR(memslice->memview);
43915  } else {
43916  PyGILState_STATE _gilstate = PyGILState_Ensure();
43917  Py_CLEAR(memslice->memview);
43918  PyGILState_Release(_gilstate);
43919  }
43920  } else {
43921  memslice->memview = NULL;
43922  }
43923 }
43924 
43925 /* PyDictVersioning */
43926 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
43927 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
43928  PyObject *dict = Py_TYPE(obj)->tp_dict;
43929  return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
43930 }
43931 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
43932  PyObject **dictptr = NULL;
43933  Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
43934  if (offset) {
43935 #if CYTHON_COMPILING_IN_CPYTHON
43936  dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
43937 #else
43938  dictptr = _PyObject_GetDictPtr(obj);
43939 #endif
43940  }
43941  return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
43942 }
43943 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
43944  PyObject *dict = Py_TYPE(obj)->tp_dict;
43945  if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
43946  return 0;
43947  return obj_dict_version == __Pyx_get_object_dict_version(obj);
43948 }
43949 #endif
43950 
43951 /* GetModuleGlobalName */
43952 #if CYTHON_USE_DICT_VERSIONS
43953 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
43954 #else
43955 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
43956 #endif
43957 {
43958  PyObject *result;
43959 #if !CYTHON_AVOID_BORROWED_REFS
43960 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
43961  result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
43962  __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
43963  if (likely(result)) {
43964  return __Pyx_NewRef(result);
43965  } else if (unlikely(PyErr_Occurred())) {
43966  return NULL;
43967  }
43968 #else
43969  result = PyDict_GetItem(__pyx_d, name);
43970  __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
43971  if (likely(result)) {
43972  return __Pyx_NewRef(result);
43973  }
43974 #endif
43975 #else
43976  result = PyObject_GetItem(__pyx_d, name);
43977  __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
43978  if (likely(result)) {
43979  return __Pyx_NewRef(result);
43980  }
43981  PyErr_Clear();
43982 #endif
43983  return __Pyx_GetBuiltinName(name);
43984 }
43985 
43986 /* PyCFunctionFastCall */
43987 #if CYTHON_FAST_PYCCALL
43988 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
43989  PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
43990  PyCFunction meth = PyCFunction_GET_FUNCTION(func);
43991  PyObject *self = PyCFunction_GET_SELF(func);
43992  int flags = PyCFunction_GET_FLAGS(func);
43993  assert(PyCFunction_Check(func));
43994  assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
43995  assert(nargs >= 0);
43996  assert(nargs == 0 || args != NULL);
43997  /* _PyCFunction_FastCallDict() must not be called with an exception set,
43998  because it may clear it (directly or indirectly) and so the
43999  caller loses its exception */
44000  assert(!PyErr_Occurred());
44001  if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
44002  return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
44003  } else {
44004  return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
44005  }
44006 }
44007 #endif
44008 
44009 /* PyFunctionFastCall */
44010 #if CYTHON_FAST_PYCALL
44011 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
44012  PyObject *globals) {
44013  PyFrameObject *f;
44014  PyThreadState *tstate = __Pyx_PyThreadState_Current;
44015  PyObject **fastlocals;
44016  Py_ssize_t i;
44017  PyObject *result;
44018  assert(globals != NULL);
44019  /* XXX Perhaps we should create a specialized
44020  PyFrame_New() that doesn't take locals, but does
44021  take builtins without sanity checking them.
44022  */
44023  assert(tstate != NULL);
44024  f = PyFrame_New(tstate, co, globals, NULL);
44025  if (f == NULL) {
44026  return NULL;
44027  }
44028  fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
44029  for (i = 0; i < na; i++) {
44030  Py_INCREF(*args);
44031  fastlocals[i] = *args++;
44032  }
44033  result = PyEval_EvalFrameEx(f,0);
44034  ++tstate->recursion_depth;
44035  Py_DECREF(f);
44036  --tstate->recursion_depth;
44037  return result;
44038 }
44039 #if 1 || PY_VERSION_HEX < 0x030600B1
44040 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
44041  PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
44042  PyObject *globals = PyFunction_GET_GLOBALS(func);
44043  PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
44044  PyObject *closure;
44045 #if PY_MAJOR_VERSION >= 3
44046  PyObject *kwdefs;
44047 #endif
44048  PyObject *kwtuple, **k;
44049  PyObject **d;
44050  Py_ssize_t nd;
44051  Py_ssize_t nk;
44052  PyObject *result;
44053  assert(kwargs == NULL || PyDict_Check(kwargs));
44054  nk = kwargs ? PyDict_Size(kwargs) : 0;
44055  if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
44056  return NULL;
44057  }
44058  if (
44059 #if PY_MAJOR_VERSION >= 3
44060  co->co_kwonlyargcount == 0 &&
44061 #endif
44062  likely(kwargs == NULL || nk == 0) &&
44063  co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
44064  if (argdefs == NULL && co->co_argcount == nargs) {
44065  result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
44066  goto done;
44067  }
44068  else if (nargs == 0 && argdefs != NULL
44069  && co->co_argcount == Py_SIZE(argdefs)) {
44070  /* function called with no arguments, but all parameters have
44071  a default value: use default values as arguments .*/
44072  args = &PyTuple_GET_ITEM(argdefs, 0);
44073  result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
44074  goto done;
44075  }
44076  }
44077  if (kwargs != NULL) {
44078  Py_ssize_t pos, i;
44079  kwtuple = PyTuple_New(2 * nk);
44080  if (kwtuple == NULL) {
44081  result = NULL;
44082  goto done;
44083  }
44084  k = &PyTuple_GET_ITEM(kwtuple, 0);
44085  pos = i = 0;
44086  while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
44087  Py_INCREF(k[i]);
44088  Py_INCREF(k[i+1]);
44089  i += 2;
44090  }
44091  nk = i / 2;
44092  }
44093  else {
44094  kwtuple = NULL;
44095  k = NULL;
44096  }
44097  closure = PyFunction_GET_CLOSURE(func);
44098 #if PY_MAJOR_VERSION >= 3
44099  kwdefs = PyFunction_GET_KW_DEFAULTS(func);
44100 #endif
44101  if (argdefs != NULL) {
44102  d = &PyTuple_GET_ITEM(argdefs, 0);
44103  nd = Py_SIZE(argdefs);
44104  }
44105  else {
44106  d = NULL;
44107  nd = 0;
44108  }
44109 #if PY_MAJOR_VERSION >= 3
44110  result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
44111  args, (int)nargs,
44112  k, (int)nk,
44113  d, (int)nd, kwdefs, closure);
44114 #else
44115  result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
44116  args, (int)nargs,
44117  k, (int)nk,
44118  d, (int)nd, closure);
44119 #endif
44120  Py_XDECREF(kwtuple);
44121 done:
44122  Py_LeaveRecursiveCall();
44123  return result;
44124 }
44125 #endif
44126 #endif
44127 
44128 /* PyObjectCall */
44129 #if CYTHON_COMPILING_IN_CPYTHON
44130 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
44131  PyObject *result;
44132  ternaryfunc call = func->ob_type->tp_call;
44133  if (unlikely(!call))
44134  return PyObject_Call(func, arg, kw);
44135  if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
44136  return NULL;
44137  result = (*call)(func, arg, kw);
44138  Py_LeaveRecursiveCall();
44139  if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
44140  PyErr_SetString(
44141  PyExc_SystemError,
44142  "NULL result without error in PyObject_Call");
44143  }
44144  return result;
44145 }
44146 #endif
44147 
44148 /* PyObjectCall2Args */
44149 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
44150  PyObject *args, *result = NULL;
44151  #if CYTHON_FAST_PYCALL
44152  if (PyFunction_Check(function)) {
44153  PyObject *args[2] = {arg1, arg2};
44154  return __Pyx_PyFunction_FastCall(function, args, 2);
44155  }
44156  #endif
44157  #if CYTHON_FAST_PYCCALL
44158  if (__Pyx_PyFastCFunction_Check(function)) {
44159  PyObject *args[2] = {arg1, arg2};
44160  return __Pyx_PyCFunction_FastCall(function, args, 2);
44161  }
44162  #endif
44163  args = PyTuple_New(2);
44164  if (unlikely(!args)) goto done;
44165  Py_INCREF(arg1);
44166  PyTuple_SET_ITEM(args, 0, arg1);
44167  Py_INCREF(arg2);
44168  PyTuple_SET_ITEM(args, 1, arg2);
44169  Py_INCREF(function);
44170  result = __Pyx_PyObject_Call(function, args, NULL);
44171  Py_DECREF(args);
44172  Py_DECREF(function);
44173 done:
44174  return result;
44175 }
44176 
44177 /* PyObjectCallMethO */
44178 #if CYTHON_COMPILING_IN_CPYTHON
44179 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
44180  PyObject *self, *result;
44181  PyCFunction cfunc;
44182  cfunc = PyCFunction_GET_FUNCTION(func);
44183  self = PyCFunction_GET_SELF(func);
44184  if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
44185  return NULL;
44186  result = cfunc(self, arg);
44187  Py_LeaveRecursiveCall();
44188  if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
44189  PyErr_SetString(
44190  PyExc_SystemError,
44191  "NULL result without error in PyObject_Call");
44192  }
44193  return result;
44194 }
44195 #endif
44196 
44197 /* PyObjectCallOneArg */
44198 #if CYTHON_COMPILING_IN_CPYTHON
44199 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
44200  PyObject *result;
44201  PyObject *args = PyTuple_New(1);
44202  if (unlikely(!args)) return NULL;
44203  Py_INCREF(arg);
44204  PyTuple_SET_ITEM(args, 0, arg);
44205  result = __Pyx_PyObject_Call(func, args, NULL);
44206  Py_DECREF(args);
44207  return result;
44208 }
44209 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
44210 #if CYTHON_FAST_PYCALL
44211  if (PyFunction_Check(func)) {
44212  return __Pyx_PyFunction_FastCall(func, &arg, 1);
44213  }
44214 #endif
44215  if (likely(PyCFunction_Check(func))) {
44216  if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
44217  return __Pyx_PyObject_CallMethO(func, arg);
44218 #if CYTHON_FAST_PYCCALL
44219  } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
44220  return __Pyx_PyCFunction_FastCall(func, &arg, 1);
44221 #endif
44222  }
44223  }
44224  return __Pyx__PyObject_CallOneArg(func, arg);
44225 }
44226 #else
44227 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
44228  PyObject *result;
44229  PyObject *args = PyTuple_Pack(1, arg);
44230  if (unlikely(!args)) return NULL;
44231  result = __Pyx_PyObject_Call(func, args, NULL);
44232  Py_DECREF(args);
44233  return result;
44234 }
44235 #endif
44236 
44237 /* PyIntBinop */
44238 #if !CYTHON_COMPILING_IN_PYPY
44239 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
44240  (void)inplace;
44241  (void)zerodivision_check;
44242  #if PY_MAJOR_VERSION < 3
44243  if (likely(PyInt_CheckExact(op1))) {
44244  const long b = intval;
44245  long x;
44246  long a = PyInt_AS_LONG(op1);
44247  x = (long)((unsigned long)a + b);
44248  if (likely((x^a) >= 0 || (x^b) >= 0))
44249  return PyInt_FromLong(x);
44250  return PyLong_Type.tp_as_number->nb_add(op1, op2);
44251  }
44252  #endif
44253  #if CYTHON_USE_PYLONG_INTERNALS
44254  if (likely(PyLong_CheckExact(op1))) {
44255  const long b = intval;
44256  long a, x;
44257 #ifdef HAVE_LONG_LONG
44258  const PY_LONG_LONG llb = intval;
44259  PY_LONG_LONG lla, llx;
44260 #endif
44261  const digit* digits = ((PyLongObject*)op1)->ob_digit;
44262  const Py_ssize_t size = Py_SIZE(op1);
44263  if (likely(__Pyx_sst_abs(size) <= 1)) {
44264  a = likely(size) ? digits[0] : 0;
44265  if (size == -1) a = -a;
44266  } else {
44267  switch (size) {
44268  case -2:
44269  if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
44270  a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
44271  break;
44272 #ifdef HAVE_LONG_LONG
44273  } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
44274  lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
44275  goto long_long;
44276 #endif
44277  }
44278  CYTHON_FALLTHROUGH;
44279  case 2:
44280  if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
44281  a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
44282  break;
44283 #ifdef HAVE_LONG_LONG
44284  } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
44285  lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
44286  goto long_long;
44287 #endif
44288  }
44289  CYTHON_FALLTHROUGH;
44290  case -3:
44291  if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
44292  a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
44293  break;
44294 #ifdef HAVE_LONG_LONG
44295  } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
44296  lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
44297  goto long_long;
44298 #endif
44299  }
44300  CYTHON_FALLTHROUGH;
44301  case 3:
44302  if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
44303  a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
44304  break;
44305 #ifdef HAVE_LONG_LONG
44306  } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
44307  lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
44308  goto long_long;
44309 #endif
44310  }
44311  CYTHON_FALLTHROUGH;
44312  case -4:
44313  if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
44314  a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
44315  break;
44316 #ifdef HAVE_LONG_LONG
44317  } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
44318  lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
44319  goto long_long;
44320 #endif
44321  }
44322  CYTHON_FALLTHROUGH;
44323  case 4:
44324  if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
44325  a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
44326  break;
44327 #ifdef HAVE_LONG_LONG
44328  } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
44329  lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
44330  goto long_long;
44331 #endif
44332  }
44333  CYTHON_FALLTHROUGH;
44334  default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
44335  }
44336  }
44337  x = a + b;
44338  return PyLong_FromLong(x);
44339 #ifdef HAVE_LONG_LONG
44340  long_long:
44341  llx = lla + llb;
44342  return PyLong_FromLongLong(llx);
44343 #endif
44344 
44345 
44346  }
44347  #endif
44348  if (PyFloat_CheckExact(op1)) {
44349  const long b = intval;
44350  double a = PyFloat_AS_DOUBLE(op1);
44351  double result;
44352  PyFPE_START_PROTECT("add", return NULL)
44353  result = ((double)a) + (double)b;
44354  PyFPE_END_PROTECT(result)
44355  return PyFloat_FromDouble(result);
44356  }
44357  return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
44358 }
44359 #endif
44360 
44361 /* GetItemInt */
44362 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
44363  PyObject *r;
44364  if (!j) return NULL;
44365  r = PyObject_GetItem(o, j);
44366  Py_DECREF(j);
44367  return r;
44368 }
44369 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
44370  CYTHON_NCP_UNUSED int wraparound,
44371  CYTHON_NCP_UNUSED int boundscheck) {
44372 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
44373  Py_ssize_t wrapped_i = i;
44374  if (wraparound & unlikely(i < 0)) {
44375  wrapped_i += PyList_GET_SIZE(o);
44376  }
44377  if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
44378  PyObject *r = PyList_GET_ITEM(o, wrapped_i);
44379  Py_INCREF(r);
44380  return r;
44381  }
44382  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
44383 #else
44384  return PySequence_GetItem(o, i);
44385 #endif
44386 }
44387 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
44388  CYTHON_NCP_UNUSED int wraparound,
44389  CYTHON_NCP_UNUSED int boundscheck) {
44390 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
44391  Py_ssize_t wrapped_i = i;
44392  if (wraparound & unlikely(i < 0)) {
44393  wrapped_i += PyTuple_GET_SIZE(o);
44394  }
44395  if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
44396  PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
44397  Py_INCREF(r);
44398  return r;
44399  }
44400  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
44401 #else
44402  return PySequence_GetItem(o, i);
44403 #endif
44404 }
44405 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
44406  CYTHON_NCP_UNUSED int wraparound,
44407  CYTHON_NCP_UNUSED int boundscheck) {
44408 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
44409  if (is_list || PyList_CheckExact(o)) {
44410  Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
44411  if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
44412  PyObject *r = PyList_GET_ITEM(o, n);
44413  Py_INCREF(r);
44414  return r;
44415  }
44416  }
44417  else if (PyTuple_CheckExact(o)) {
44418  Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
44419  if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
44420  PyObject *r = PyTuple_GET_ITEM(o, n);
44421  Py_INCREF(r);
44422  return r;
44423  }
44424  } else {
44425  PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
44426  if (likely(m && m->sq_item)) {
44427  if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
44428  Py_ssize_t l = m->sq_length(o);
44429  if (likely(l >= 0)) {
44430  i += l;
44431  } else {
44432  if (!PyErr_ExceptionMatches(PyExc_OverflowError))
44433  return NULL;
44434  PyErr_Clear();
44435  }
44436  }
44437  return m->sq_item(o, i);
44438  }
44439  }
44440 #else
44441  if (is_list || PySequence_Check(o)) {
44442  return PySequence_GetItem(o, i);
44443  }
44444 #endif
44445  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
44446 }
44447 
44448 /* ObjectGetItem */
44449 #if CYTHON_USE_TYPE_SLOTS
44450 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
44451  PyObject *runerr;
44452  Py_ssize_t key_value;
44453  PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
44454  if (unlikely(!(m && m->sq_item))) {
44455  PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
44456  return NULL;
44457  }
44458  key_value = __Pyx_PyIndex_AsSsize_t(index);
44459  if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
44460  return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
44461  }
44462  if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
44463  PyErr_Clear();
44464  PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
44465  }
44466  return NULL;
44467 }
44468 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
44469  PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
44470  if (likely(m && m->mp_subscript)) {
44471  return m->mp_subscript(obj, key);
44472  }
44473  return __Pyx_PyObject_GetIndex(obj, key);
44474 }
44475 #endif
44476 
44477 /* IterFinish */
44478 static CYTHON_INLINE int __Pyx_IterFinish(void) {
44479 #if CYTHON_FAST_THREAD_STATE
44480  PyThreadState *tstate = __Pyx_PyThreadState_Current;
44481  PyObject* exc_type = tstate->curexc_type;
44482  if (unlikely(exc_type)) {
44483  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
44484  PyObject *exc_value, *exc_tb;
44485  exc_value = tstate->curexc_value;
44486  exc_tb = tstate->curexc_traceback;
44487  tstate->curexc_type = 0;
44488  tstate->curexc_value = 0;
44489  tstate->curexc_traceback = 0;
44490  Py_DECREF(exc_type);
44491  Py_XDECREF(exc_value);
44492  Py_XDECREF(exc_tb);
44493  return 0;
44494  } else {
44495  return -1;
44496  }
44497  }
44498  return 0;
44499 #else
44500  if (unlikely(PyErr_Occurred())) {
44501  if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
44502  PyErr_Clear();
44503  return 0;
44504  } else {
44505  return -1;
44506  }
44507  }
44508  return 0;
44509 #endif
44510 }
44511 
44512 /* set_iter */
44513 static CYTHON_INLINE PyObject* __Pyx_set_iterator(PyObject* iterable, int is_set,
44514  Py_ssize_t* p_orig_length, int* p_source_is_set) {
44515 #if CYTHON_COMPILING_IN_CPYTHON
44516  is_set = is_set || likely(PySet_CheckExact(iterable) || PyFrozenSet_CheckExact(iterable));
44517  *p_source_is_set = is_set;
44518  if (likely(is_set)) {
44519  *p_orig_length = PySet_Size(iterable);
44520  Py_INCREF(iterable);
44521  return iterable;
44522  }
44523 #else
44524  (void)is_set;
44525  *p_source_is_set = 0;
44526 #endif
44527  *p_orig_length = 0;
44528  return PyObject_GetIter(iterable);
44529 }
44530 static CYTHON_INLINE int __Pyx_set_iter_next(
44531  PyObject* iter_obj, Py_ssize_t orig_length,
44532  Py_ssize_t* ppos, PyObject **value,
44533  int source_is_set) {
44534  if (!CYTHON_COMPILING_IN_CPYTHON || unlikely(!source_is_set)) {
44535  *value = PyIter_Next(iter_obj);
44536  if (unlikely(!*value)) {
44537  return __Pyx_IterFinish();
44538  }
44539  (void)orig_length;
44540  (void)ppos;
44541  return 1;
44542  }
44543 #if CYTHON_COMPILING_IN_CPYTHON
44544  if (unlikely(PySet_GET_SIZE(iter_obj) != orig_length)) {
44545  PyErr_SetString(
44546  PyExc_RuntimeError,
44547  "set changed size during iteration");
44548  return -1;
44549  }
44550  {
44551  Py_hash_t hash;
44552  int ret = _PySet_NextEntry(iter_obj, ppos, value, &hash);
44553  assert (ret != -1);
44554  if (likely(ret)) {
44555  Py_INCREF(*value);
44556  return 1;
44557  }
44558  }
44559 #endif
44560  return 0;
44561 }
44562 
44563 /* Import */
44564 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
44565  PyObject *empty_list = 0;
44566  PyObject *module = 0;
44567  PyObject *global_dict = 0;
44568  PyObject *empty_dict = 0;
44569  PyObject *list;
44570  #if PY_MAJOR_VERSION < 3
44571  PyObject *py_import;
44572  py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
44573  if (!py_import)
44574  goto bad;
44575  #endif
44576  if (from_list)
44577  list = from_list;
44578  else {
44579  empty_list = PyList_New(0);
44580  if (!empty_list)
44581  goto bad;
44582  list = empty_list;
44583  }
44584  global_dict = PyModule_GetDict(__pyx_m);
44585  if (!global_dict)
44586  goto bad;
44587  empty_dict = PyDict_New();
44588  if (!empty_dict)
44589  goto bad;
44590  {
44591  #if PY_MAJOR_VERSION >= 3
44592  if (level == -1) {
44593  if (strchr(__Pyx_MODULE_NAME, '.')) {
44594  module = PyImport_ImportModuleLevelObject(
44595  name, global_dict, empty_dict, list, 1);
44596  if (!module) {
44597  if (!PyErr_ExceptionMatches(PyExc_ImportError))
44598  goto bad;
44599  PyErr_Clear();
44600  }
44601  }
44602  level = 0;
44603  }
44604  #endif
44605  if (!module) {
44606  #if PY_MAJOR_VERSION < 3
44607  PyObject *py_level = PyInt_FromLong(level);
44608  if (!py_level)
44609  goto bad;
44610  module = PyObject_CallFunctionObjArgs(py_import,
44611  name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
44612  Py_DECREF(py_level);
44613  #else
44614  module = PyImport_ImportModuleLevelObject(
44615  name, global_dict, empty_dict, list, level);
44616  #endif
44617  }
44618  }
44619 bad:
44620  #if PY_MAJOR_VERSION < 3
44621  Py_XDECREF(py_import);
44622  #endif
44623  Py_XDECREF(empty_list);
44624  Py_XDECREF(empty_dict);
44625  return module;
44626 }
44627 
44628 /* ImportFrom */
44629 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
44630  PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
44631  if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
44632  PyErr_Format(PyExc_ImportError,
44633  #if PY_MAJOR_VERSION < 3
44634  "cannot import name %.230s", PyString_AS_STRING(name));
44635  #else
44636  "cannot import name %S", name);
44637  #endif
44638  }
44639  return value;
44640 }
44641 
44642 /* PyObjectCallNoArg */
44643 #if CYTHON_COMPILING_IN_CPYTHON
44644 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
44645 #if CYTHON_FAST_PYCALL
44646  if (PyFunction_Check(func)) {
44647  return __Pyx_PyFunction_FastCall(func, NULL, 0);
44648  }
44649 #endif
44650 #ifdef __Pyx_CyFunction_USED
44651  if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
44652 #else
44653  if (likely(PyCFunction_Check(func)))
44654 #endif
44655  {
44656  if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
44657  return __Pyx_PyObject_CallMethO(func, NULL);
44658  }
44659  }
44660  return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
44661 }
44662 #endif
44663 
44664 /* DictGetItem */
44665 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
44666 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
44667  PyObject *value;
44668  value = PyDict_GetItemWithError(d, key);
44669  if (unlikely(!value)) {
44670  if (!PyErr_Occurred()) {
44671  if (unlikely(PyTuple_Check(key))) {
44672  PyObject* args = PyTuple_Pack(1, key);
44673  if (likely(args)) {
44674  PyErr_SetObject(PyExc_KeyError, args);
44675  Py_DECREF(args);
44676  }
44677  } else {
44678  PyErr_SetObject(PyExc_KeyError, key);
44679  }
44680  }
44681  return NULL;
44682  }
44683  Py_INCREF(value);
44684  return value;
44685 }
44686 #endif
44687 
44688 /* SliceObject */
44689 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
44690  Py_ssize_t cstart, Py_ssize_t cstop,
44691  PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
44692  int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
44693 #if CYTHON_USE_TYPE_SLOTS
44694  PyMappingMethods* mp;
44695 #if PY_MAJOR_VERSION < 3
44696  PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
44697  if (likely(ms && ms->sq_slice)) {
44698  if (!has_cstart) {
44699  if (_py_start && (*_py_start != Py_None)) {
44700  cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
44701  if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
44702  } else
44703  cstart = 0;
44704  }
44705  if (!has_cstop) {
44706  if (_py_stop && (*_py_stop != Py_None)) {
44707  cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
44708  if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
44709  } else
44710  cstop = PY_SSIZE_T_MAX;
44711  }
44712  if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
44713  Py_ssize_t l = ms->sq_length(obj);
44714  if (likely(l >= 0)) {
44715  if (cstop < 0) {
44716  cstop += l;
44717  if (cstop < 0) cstop = 0;
44718  }
44719  if (cstart < 0) {
44720  cstart += l;
44721  if (cstart < 0) cstart = 0;
44722  }
44723  } else {
44724  if (!PyErr_ExceptionMatches(PyExc_OverflowError))
44725  goto bad;
44726  PyErr_Clear();
44727  }
44728  }
44729  return ms->sq_slice(obj, cstart, cstop);
44730  }
44731 #endif
44732  mp = Py_TYPE(obj)->tp_as_mapping;
44733  if (likely(mp && mp->mp_subscript))
44734 #endif
44735  {
44736  PyObject* result;
44737  PyObject *py_slice, *py_start, *py_stop;
44738  if (_py_slice) {
44739  py_slice = *_py_slice;
44740  } else {
44741  PyObject* owned_start = NULL;
44742  PyObject* owned_stop = NULL;
44743  if (_py_start) {
44744  py_start = *_py_start;
44745  } else {
44746  if (has_cstart) {
44747  owned_start = py_start = PyInt_FromSsize_t(cstart);
44748  if (unlikely(!py_start)) goto bad;
44749  } else
44750  py_start = Py_None;
44751  }
44752  if (_py_stop) {
44753  py_stop = *_py_stop;
44754  } else {
44755  if (has_cstop) {
44756  owned_stop = py_stop = PyInt_FromSsize_t(cstop);
44757  if (unlikely(!py_stop)) {
44758  Py_XDECREF(owned_start);
44759  goto bad;
44760  }
44761  } else
44762  py_stop = Py_None;
44763  }
44764  py_slice = PySlice_New(py_start, py_stop, Py_None);
44765  Py_XDECREF(owned_start);
44766  Py_XDECREF(owned_stop);
44767  if (unlikely(!py_slice)) goto bad;
44768  }
44769 #if CYTHON_USE_TYPE_SLOTS
44770  result = mp->mp_subscript(obj, py_slice);
44771 #else
44772  result = PyObject_GetItem(obj, py_slice);
44773 #endif
44774  if (!_py_slice) {
44775  Py_DECREF(py_slice);
44776  }
44777  return result;
44778  }
44779  PyErr_Format(PyExc_TypeError,
44780  "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
44781 bad:
44782  return NULL;
44783 }
44784 
44785 /* SetItemInt */
44786 static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
44787  int r;
44788  if (!j) return -1;
44789  r = PyObject_SetItem(o, j, v);
44790  Py_DECREF(j);
44791  return r;
44792 }
44793 static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
44794  CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) {
44795 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
44796  if (is_list || PyList_CheckExact(o)) {
44797  Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
44798  if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) {
44799  PyObject* old = PyList_GET_ITEM(o, n);
44800  Py_INCREF(v);
44801  PyList_SET_ITEM(o, n, v);
44802  Py_DECREF(old);
44803  return 1;
44804  }
44805  } else {
44806  PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
44807  if (likely(m && m->sq_ass_item)) {
44808  if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
44809  Py_ssize_t l = m->sq_length(o);
44810  if (likely(l >= 0)) {
44811  i += l;
44812  } else {
44813  if (!PyErr_ExceptionMatches(PyExc_OverflowError))
44814  return -1;
44815  PyErr_Clear();
44816  }
44817  }
44818  return m->sq_ass_item(o, i, v);
44819  }
44820  }
44821 #else
44822 #if CYTHON_COMPILING_IN_PYPY
44823  if (is_list || (PySequence_Check(o) && !PyDict_Check(o)))
44824 #else
44825  if (is_list || PySequence_Check(o))
44826 #endif
44827  {
44828  return PySequence_SetItem(o, i, v);
44829  }
44830 #endif
44831  return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
44832 }
44833 
44834 /* PyErrFetchRestore */
44835 #if CYTHON_FAST_THREAD_STATE
44836 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
44837  PyObject *tmp_type, *tmp_value, *tmp_tb;
44838  tmp_type = tstate->curexc_type;
44839  tmp_value = tstate->curexc_value;
44840  tmp_tb = tstate->curexc_traceback;
44841  tstate->curexc_type = type;
44842  tstate->curexc_value = value;
44843  tstate->curexc_traceback = tb;
44844  Py_XDECREF(tmp_type);
44845  Py_XDECREF(tmp_value);
44846  Py_XDECREF(tmp_tb);
44847 }
44848 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
44849  *type = tstate->curexc_type;
44850  *value = tstate->curexc_value;
44851  *tb = tstate->curexc_traceback;
44852  tstate->curexc_type = 0;
44853  tstate->curexc_value = 0;
44854  tstate->curexc_traceback = 0;
44855 }
44856 #endif
44857 
44858 /* WriteUnraisableException */
44859 static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
44860  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
44861  int full_traceback, CYTHON_UNUSED int nogil) {
44862  PyObject *old_exc, *old_val, *old_tb;
44863  PyObject *ctx;
44864  __Pyx_PyThreadState_declare
44865 #ifdef WITH_THREAD
44866  PyGILState_STATE state;
44867  if (nogil)
44868  state = PyGILState_Ensure();
44869 #ifdef _MSC_VER
44870  else state = (PyGILState_STATE)-1;
44871 #endif
44872 #endif
44873  __Pyx_PyThreadState_assign
44874  __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
44875  if (full_traceback) {
44876  Py_XINCREF(old_exc);
44877  Py_XINCREF(old_val);
44878  Py_XINCREF(old_tb);
44879  __Pyx_ErrRestore(old_exc, old_val, old_tb);
44880  PyErr_PrintEx(1);
44881  }
44882  #if PY_MAJOR_VERSION < 3
44883  ctx = PyString_FromString(name);
44884  #else
44885  ctx = PyUnicode_FromString(name);
44886  #endif
44887  __Pyx_ErrRestore(old_exc, old_val, old_tb);
44888  if (!ctx) {
44889  PyErr_WriteUnraisable(Py_None);
44890  } else {
44891  PyErr_WriteUnraisable(ctx);
44892  Py_DECREF(ctx);
44893  }
44894 #ifdef WITH_THREAD
44895  if (nogil)
44896  PyGILState_Release(state);
44897 #endif
44898 }
44899 
44900 /* ExtTypeTest */
44901 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
44902  if (unlikely(!type)) {
44903  PyErr_SetString(PyExc_SystemError, "Missing type object");
44904  return 0;
44905  }
44906  if (likely(__Pyx_TypeCheck(obj, type)))
44907  return 1;
44908  PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
44909  Py_TYPE(obj)->tp_name, type->tp_name);
44910  return 0;
44911 }
44912 
44913 /* RaiseException */
44914 #if PY_MAJOR_VERSION < 3
44915 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
44916  CYTHON_UNUSED PyObject *cause) {
44917  __Pyx_PyThreadState_declare
44918  Py_XINCREF(type);
44919  if (!value || value == Py_None)
44920  value = NULL;
44921  else
44922  Py_INCREF(value);
44923  if (!tb || tb == Py_None)
44924  tb = NULL;
44925  else {
44926  Py_INCREF(tb);
44927  if (!PyTraceBack_Check(tb)) {
44928  PyErr_SetString(PyExc_TypeError,
44929  "raise: arg 3 must be a traceback or None");
44930  goto raise_error;
44931  }
44932  }
44933  if (PyType_Check(type)) {
44934 #if CYTHON_COMPILING_IN_PYPY
44935  if (!value) {
44936  Py_INCREF(Py_None);
44937  value = Py_None;
44938  }
44939 #endif
44940  PyErr_NormalizeException(&type, &value, &tb);
44941  } else {
44942  if (value) {
44943  PyErr_SetString(PyExc_TypeError,
44944  "instance exception may not have a separate value");
44945  goto raise_error;
44946  }
44947  value = type;
44948  type = (PyObject*) Py_TYPE(type);
44949  Py_INCREF(type);
44950  if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
44951  PyErr_SetString(PyExc_TypeError,
44952  "raise: exception class must be a subclass of BaseException");
44953  goto raise_error;
44954  }
44955  }
44956  __Pyx_PyThreadState_assign
44957  __Pyx_ErrRestore(type, value, tb);
44958  return;
44959 raise_error:
44960  Py_XDECREF(value);
44961  Py_XDECREF(type);
44962  Py_XDECREF(tb);
44963  return;
44964 }
44965 #else
44966 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
44967  PyObject* owned_instance = NULL;
44968  if (tb == Py_None) {
44969  tb = 0;
44970  } else if (tb && !PyTraceBack_Check(tb)) {
44971  PyErr_SetString(PyExc_TypeError,
44972  "raise: arg 3 must be a traceback or None");
44973  goto bad;
44974  }
44975  if (value == Py_None)
44976  value = 0;
44977  if (PyExceptionInstance_Check(type)) {
44978  if (value) {
44979  PyErr_SetString(PyExc_TypeError,
44980  "instance exception may not have a separate value");
44981  goto bad;
44982  }
44983  value = type;
44984  type = (PyObject*) Py_TYPE(value);
44985  } else if (PyExceptionClass_Check(type)) {
44986  PyObject *instance_class = NULL;
44987  if (value && PyExceptionInstance_Check(value)) {
44988  instance_class = (PyObject*) Py_TYPE(value);
44989  if (instance_class != type) {
44990  int is_subclass = PyObject_IsSubclass(instance_class, type);
44991  if (!is_subclass) {
44992  instance_class = NULL;
44993  } else if (unlikely(is_subclass == -1)) {
44994  goto bad;
44995  } else {
44996  type = instance_class;
44997  }
44998  }
44999  }
45000  if (!instance_class) {
45001  PyObject *args;
45002  if (!value)
45003  args = PyTuple_New(0);
45004  else if (PyTuple_Check(value)) {
45005  Py_INCREF(value);
45006  args = value;
45007  } else
45008  args = PyTuple_Pack(1, value);
45009  if (!args)
45010  goto bad;
45011  owned_instance = PyObject_Call(type, args, NULL);
45012  Py_DECREF(args);
45013  if (!owned_instance)
45014  goto bad;
45015  value = owned_instance;
45016  if (!PyExceptionInstance_Check(value)) {
45017  PyErr_Format(PyExc_TypeError,
45018  "calling %R should have returned an instance of "
45019  "BaseException, not %R",
45020  type, Py_TYPE(value));
45021  goto bad;
45022  }
45023  }
45024  } else {
45025  PyErr_SetString(PyExc_TypeError,
45026  "raise: exception class must be a subclass of BaseException");
45027  goto bad;
45028  }
45029  if (cause) {
45030  PyObject *fixed_cause;
45031  if (cause == Py_None) {
45032  fixed_cause = NULL;
45033  } else if (PyExceptionClass_Check(cause)) {
45034  fixed_cause = PyObject_CallObject(cause, NULL);
45035  if (fixed_cause == NULL)
45036  goto bad;
45037  } else if (PyExceptionInstance_Check(cause)) {
45038  fixed_cause = cause;
45039  Py_INCREF(fixed_cause);
45040  } else {
45041  PyErr_SetString(PyExc_TypeError,
45042  "exception causes must derive from "
45043  "BaseException");
45044  goto bad;
45045  }
45046  PyException_SetCause(value, fixed_cause);
45047  }
45048  PyErr_SetObject(type, value);
45049  if (tb) {
45050 #if CYTHON_COMPILING_IN_PYPY
45051  PyObject *tmp_type, *tmp_value, *tmp_tb;
45052  PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
45053  Py_INCREF(tb);
45054  PyErr_Restore(tmp_type, tmp_value, tb);
45055  Py_XDECREF(tmp_tb);
45056 #else
45057  PyThreadState *tstate = __Pyx_PyThreadState_Current;
45058  PyObject* tmp_tb = tstate->curexc_traceback;
45059  if (tb != tmp_tb) {
45060  Py_INCREF(tb);
45061  tstate->curexc_traceback = tb;
45062  Py_XDECREF(tmp_tb);
45063  }
45064 #endif
45065  }
45066 bad:
45067  Py_XDECREF(owned_instance);
45068  return;
45069 }
45070 #endif
45071 
45072 /* RaiseTooManyValuesToUnpack */
45073 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
45074  PyErr_Format(PyExc_ValueError,
45075  "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
45076 }
45077 
45078 /* RaiseNeedMoreValuesToUnpack */
45079 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
45080  PyErr_Format(PyExc_ValueError,
45081  "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
45082  index, (index == 1) ? "" : "s");
45083 }
45084 
45085 /* RaiseNoneIterError */
45086 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
45087  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
45088 }
45089 
45090 /* GetTopmostException */
45091 #if CYTHON_USE_EXC_INFO_STACK
45092 static _PyErr_StackItem *
45093 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
45094 {
45095  _PyErr_StackItem *exc_info = tstate->exc_info;
45096  while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
45097  exc_info->previous_item != NULL)
45098  {
45099  exc_info = exc_info->previous_item;
45100  }
45101  return exc_info;
45102 }
45103 #endif
45104 
45105 /* SaveResetException */
45106 #if CYTHON_FAST_THREAD_STATE
45107 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
45108  #if CYTHON_USE_EXC_INFO_STACK
45109  _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
45110  *type = exc_info->exc_type;
45111  *value = exc_info->exc_value;
45112  *tb = exc_info->exc_traceback;
45113  #else
45114  *type = tstate->exc_type;
45115  *value = tstate->exc_value;
45116  *tb = tstate->exc_traceback;
45117  #endif
45118  Py_XINCREF(*type);
45119  Py_XINCREF(*value);
45120  Py_XINCREF(*tb);
45121 }
45122 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
45123  PyObject *tmp_type, *tmp_value, *tmp_tb;
45124  #if CYTHON_USE_EXC_INFO_STACK
45125  _PyErr_StackItem *exc_info = tstate->exc_info;
45126  tmp_type = exc_info->exc_type;
45127  tmp_value = exc_info->exc_value;
45128  tmp_tb = exc_info->exc_traceback;
45129  exc_info->exc_type = type;
45130  exc_info->exc_value = value;
45131  exc_info->exc_traceback = tb;
45132  #else
45133  tmp_type = tstate->exc_type;
45134  tmp_value = tstate->exc_value;
45135  tmp_tb = tstate->exc_traceback;
45136  tstate->exc_type = type;
45137  tstate->exc_value = value;
45138  tstate->exc_traceback = tb;
45139  #endif
45140  Py_XDECREF(tmp_type);
45141  Py_XDECREF(tmp_value);
45142  Py_XDECREF(tmp_tb);
45143 }
45144 #endif
45145 
45146 /* PyErrExceptionMatches */
45147 #if CYTHON_FAST_THREAD_STATE
45148 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
45149  Py_ssize_t i, n;
45150  n = PyTuple_GET_SIZE(tuple);
45151 #if PY_MAJOR_VERSION >= 3
45152  for (i=0; i<n; i++) {
45153  if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
45154  }
45155 #endif
45156  for (i=0; i<n; i++) {
45157  if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
45158  }
45159  return 0;
45160 }
45161 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
45162  PyObject *exc_type = tstate->curexc_type;
45163  if (exc_type == err) return 1;
45164  if (unlikely(!exc_type)) return 0;
45165  if (unlikely(PyTuple_Check(err)))
45166  return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
45167  return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
45168 }
45169 #endif
45170 
45171 /* GetException */
45172 #if CYTHON_FAST_THREAD_STATE
45173 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
45174 #else
45175 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
45176 #endif
45177 {
45178  PyObject *local_type, *local_value, *local_tb;
45179 #if CYTHON_FAST_THREAD_STATE
45180  PyObject *tmp_type, *tmp_value, *tmp_tb;
45181  local_type = tstate->curexc_type;
45182  local_value = tstate->curexc_value;
45183  local_tb = tstate->curexc_traceback;
45184  tstate->curexc_type = 0;
45185  tstate->curexc_value = 0;
45186  tstate->curexc_traceback = 0;
45187 #else
45188  PyErr_Fetch(&local_type, &local_value, &local_tb);
45189 #endif
45190  PyErr_NormalizeException(&local_type, &local_value, &local_tb);
45191 #if CYTHON_FAST_THREAD_STATE
45192  if (unlikely(tstate->curexc_type))
45193 #else
45194  if (unlikely(PyErr_Occurred()))
45195 #endif
45196  goto bad;
45197  #if PY_MAJOR_VERSION >= 3
45198  if (local_tb) {
45199  if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
45200  goto bad;
45201  }
45202  #endif
45203  Py_XINCREF(local_tb);
45204  Py_XINCREF(local_type);
45205  Py_XINCREF(local_value);
45206  *type = local_type;
45207  *value = local_value;
45208  *tb = local_tb;
45209 #if CYTHON_FAST_THREAD_STATE
45210  #if CYTHON_USE_EXC_INFO_STACK
45211  {
45212  _PyErr_StackItem *exc_info = tstate->exc_info;
45213  tmp_type = exc_info->exc_type;
45214  tmp_value = exc_info->exc_value;
45215  tmp_tb = exc_info->exc_traceback;
45216  exc_info->exc_type = local_type;
45217  exc_info->exc_value = local_value;
45218  exc_info->exc_traceback = local_tb;
45219  }
45220  #else
45221  tmp_type = tstate->exc_type;
45222  tmp_value = tstate->exc_value;
45223  tmp_tb = tstate->exc_traceback;
45224  tstate->exc_type = local_type;
45225  tstate->exc_value = local_value;
45226  tstate->exc_traceback = local_tb;
45227  #endif
45228  Py_XDECREF(tmp_type);
45229  Py_XDECREF(tmp_value);
45230  Py_XDECREF(tmp_tb);
45231 #else
45232  PyErr_SetExcInfo(local_type, local_value, local_tb);
45233 #endif
45234  return 0;
45235 bad:
45236  *type = 0;
45237  *value = 0;
45238  *tb = 0;
45239  Py_XDECREF(local_type);
45240  Py_XDECREF(local_value);
45241  Py_XDECREF(local_tb);
45242  return -1;
45243 }
45244 
45245 /* ArgTypeTest */
45246 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
45247 {
45248  if (unlikely(!type)) {
45249  PyErr_SetString(PyExc_SystemError, "Missing type object");
45250  return 0;
45251  }
45252  else if (exact) {
45253  #if PY_MAJOR_VERSION == 2
45254  if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
45255  #endif
45256  }
45257  else {
45258  if (likely(__Pyx_TypeCheck(obj, type))) return 1;
45259  }
45260  PyErr_Format(PyExc_TypeError,
45261  "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
45262  name, type->tp_name, Py_TYPE(obj)->tp_name);
45263  return 0;
45264 }
45265 
45266 /* BytesEquals */
45267 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
45268 #if CYTHON_COMPILING_IN_PYPY
45269  return PyObject_RichCompareBool(s1, s2, equals);
45270 #else
45271  if (s1 == s2) {
45272  return (equals == Py_EQ);
45273  } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
45274  const char *ps1, *ps2;
45275  Py_ssize_t length = PyBytes_GET_SIZE(s1);
45276  if (length != PyBytes_GET_SIZE(s2))
45277  return (equals == Py_NE);
45278  ps1 = PyBytes_AS_STRING(s1);
45279  ps2 = PyBytes_AS_STRING(s2);
45280  if (ps1[0] != ps2[0]) {
45281  return (equals == Py_NE);
45282  } else if (length == 1) {
45283  return (equals == Py_EQ);
45284  } else {
45285  int result;
45286 #if CYTHON_USE_UNICODE_INTERNALS
45287  Py_hash_t hash1, hash2;
45288  hash1 = ((PyBytesObject*)s1)->ob_shash;
45289  hash2 = ((PyBytesObject*)s2)->ob_shash;
45290  if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
45291  return (equals == Py_NE);
45292  }
45293 #endif
45294  result = memcmp(ps1, ps2, (size_t)length);
45295  return (equals == Py_EQ) ? (result == 0) : (result != 0);
45296  }
45297  } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
45298  return (equals == Py_NE);
45299  } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
45300  return (equals == Py_NE);
45301  } else {
45302  int result;
45303  PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
45304  if (!py_result)
45305  return -1;
45306  result = __Pyx_PyObject_IsTrue(py_result);
45307  Py_DECREF(py_result);
45308  return result;
45309  }
45310 #endif
45311 }
45312 
45313 /* UnicodeEquals */
45314 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
45315 #if CYTHON_COMPILING_IN_PYPY
45316  return PyObject_RichCompareBool(s1, s2, equals);
45317 #else
45318 #if PY_MAJOR_VERSION < 3
45319  PyObject* owned_ref = NULL;
45320 #endif
45321  int s1_is_unicode, s2_is_unicode;
45322  if (s1 == s2) {
45323  goto return_eq;
45324  }
45325  s1_is_unicode = PyUnicode_CheckExact(s1);
45326  s2_is_unicode = PyUnicode_CheckExact(s2);
45327 #if PY_MAJOR_VERSION < 3
45328  if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
45329  owned_ref = PyUnicode_FromObject(s2);
45330  if (unlikely(!owned_ref))
45331  return -1;
45332  s2 = owned_ref;
45333  s2_is_unicode = 1;
45334  } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
45335  owned_ref = PyUnicode_FromObject(s1);
45336  if (unlikely(!owned_ref))
45337  return -1;
45338  s1 = owned_ref;
45339  s1_is_unicode = 1;
45340  } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
45341  return __Pyx_PyBytes_Equals(s1, s2, equals);
45342  }
45343 #endif
45344  if (s1_is_unicode & s2_is_unicode) {
45345  Py_ssize_t length;
45346  int kind;
45347  void *data1, *data2;
45348  if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
45349  return -1;
45350  length = __Pyx_PyUnicode_GET_LENGTH(s1);
45351  if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
45352  goto return_ne;
45353  }
45354 #if CYTHON_USE_UNICODE_INTERNALS
45355  {
45356  Py_hash_t hash1, hash2;
45357  #if CYTHON_PEP393_ENABLED
45358  hash1 = ((PyASCIIObject*)s1)->hash;
45359  hash2 = ((PyASCIIObject*)s2)->hash;
45360  #else
45361  hash1 = ((PyUnicodeObject*)s1)->hash;
45362  hash2 = ((PyUnicodeObject*)s2)->hash;
45363  #endif
45364  if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
45365  goto return_ne;
45366  }
45367  }
45368 #endif
45369  kind = __Pyx_PyUnicode_KIND(s1);
45370  if (kind != __Pyx_PyUnicode_KIND(s2)) {
45371  goto return_ne;
45372  }
45373  data1 = __Pyx_PyUnicode_DATA(s1);
45374  data2 = __Pyx_PyUnicode_DATA(s2);
45375  if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
45376  goto return_ne;
45377  } else if (length == 1) {
45378  goto return_eq;
45379  } else {
45380  int result = memcmp(data1, data2, (size_t)(length * kind));
45381  #if PY_MAJOR_VERSION < 3
45382  Py_XDECREF(owned_ref);
45383  #endif
45384  return (equals == Py_EQ) ? (result == 0) : (result != 0);
45385  }
45386  } else if ((s1 == Py_None) & s2_is_unicode) {
45387  goto return_ne;
45388  } else if ((s2 == Py_None) & s1_is_unicode) {
45389  goto return_ne;
45390  } else {
45391  int result;
45392  PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
45393  #if PY_MAJOR_VERSION < 3
45394  Py_XDECREF(owned_ref);
45395  #endif
45396  if (!py_result)
45397  return -1;
45398  result = __Pyx_PyObject_IsTrue(py_result);
45399  Py_DECREF(py_result);
45400  return result;
45401  }
45402 return_eq:
45403  #if PY_MAJOR_VERSION < 3
45404  Py_XDECREF(owned_ref);
45405  #endif
45406  return (equals == Py_EQ);
45407 return_ne:
45408  #if PY_MAJOR_VERSION < 3
45409  Py_XDECREF(owned_ref);
45410  #endif
45411  return (equals == Py_NE);
45412 #endif
45413 }
45414 
45415 /* GetAttr */
45416 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
45417 #if CYTHON_USE_TYPE_SLOTS
45418 #if PY_MAJOR_VERSION >= 3
45419  if (likely(PyUnicode_Check(n)))
45420 #else
45421  if (likely(PyString_Check(n)))
45422 #endif
45423  return __Pyx_PyObject_GetAttrStr(o, n);
45424 #endif
45425  return PyObject_GetAttr(o, n);
45426 }
45427 
45428 /* decode_c_string */
45429 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
45430  const char* cstring, Py_ssize_t start, Py_ssize_t stop,
45431  const char* encoding, const char* errors,
45432  PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
45433  Py_ssize_t length;
45434  if (unlikely((start < 0) | (stop < 0))) {
45435  size_t slen = strlen(cstring);
45436  if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
45437  PyErr_SetString(PyExc_OverflowError,
45438  "c-string too long to convert to Python");
45439  return NULL;
45440  }
45441  length = (Py_ssize_t) slen;
45442  if (start < 0) {
45443  start += length;
45444  if (start < 0)
45445  start = 0;
45446  }
45447  if (stop < 0)
45448  stop += length;
45449  }
45450  length = stop - start;
45451  if (unlikely(length <= 0))
45452  return PyUnicode_FromUnicode(NULL, 0);
45453  cstring += start;
45454  if (decode_func) {
45455  return decode_func(cstring, length, errors);
45456  } else {
45457  return PyUnicode_Decode(cstring, length, encoding, errors);
45458  }
45459 }
45460 
45461 /* GetAttr3 */
45462 static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
45463  __Pyx_PyThreadState_declare
45464  __Pyx_PyThreadState_assign
45465  if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
45466  return NULL;
45467  __Pyx_PyErr_Clear();
45468  Py_INCREF(d);
45469  return d;
45470 }
45471 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
45472  PyObject *r = __Pyx_GetAttr(o, n);
45473  return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
45474 }
45475 
45476 /* SwapException */
45477 #if CYTHON_FAST_THREAD_STATE
45478 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
45479  PyObject *tmp_type, *tmp_value, *tmp_tb;
45480  #if CYTHON_USE_EXC_INFO_STACK
45481  _PyErr_StackItem *exc_info = tstate->exc_info;
45482  tmp_type = exc_info->exc_type;
45483  tmp_value = exc_info->exc_value;
45484  tmp_tb = exc_info->exc_traceback;
45485  exc_info->exc_type = *type;
45486  exc_info->exc_value = *value;
45487  exc_info->exc_traceback = *tb;
45488  #else
45489  tmp_type = tstate->exc_type;
45490  tmp_value = tstate->exc_value;
45491  tmp_tb = tstate->exc_traceback;
45492  tstate->exc_type = *type;
45493  tstate->exc_value = *value;
45494  tstate->exc_traceback = *tb;
45495  #endif
45496  *type = tmp_type;
45497  *value = tmp_value;
45498  *tb = tmp_tb;
45499 }
45500 #else
45501 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
45502  PyObject *tmp_type, *tmp_value, *tmp_tb;
45503  PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
45504  PyErr_SetExcInfo(*type, *value, *tb);
45505  *type = tmp_type;
45506  *value = tmp_value;
45507  *tb = tmp_tb;
45508 }
45509 #endif
45510 
45511 /* FastTypeChecks */
45512 #if CYTHON_COMPILING_IN_CPYTHON
45513 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
45514  while (a) {
45515  a = a->tp_base;
45516  if (a == b)
45517  return 1;
45518  }
45519  return b == &PyBaseObject_Type;
45520 }
45521 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
45522  PyObject *mro;
45523  if (a == b) return 1;
45524  mro = a->tp_mro;
45525  if (likely(mro)) {
45526  Py_ssize_t i, n;
45527  n = PyTuple_GET_SIZE(mro);
45528  for (i = 0; i < n; i++) {
45529  if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
45530  return 1;
45531  }
45532  return 0;
45533  }
45534  return __Pyx_InBases(a, b);
45535 }
45536 #if PY_MAJOR_VERSION == 2
45537 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
45538  PyObject *exception, *value, *tb;
45539  int res;
45540  __Pyx_PyThreadState_declare
45541  __Pyx_PyThreadState_assign
45542  __Pyx_ErrFetch(&exception, &value, &tb);
45543  res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
45544  if (unlikely(res == -1)) {
45545  PyErr_WriteUnraisable(err);
45546  res = 0;
45547  }
45548  if (!res) {
45549  res = PyObject_IsSubclass(err, exc_type2);
45550  if (unlikely(res == -1)) {
45551  PyErr_WriteUnraisable(err);
45552  res = 0;
45553  }
45554  }
45555  __Pyx_ErrRestore(exception, value, tb);
45556  return res;
45557 }
45558 #else
45559 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
45560  int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
45561  if (!res) {
45562  res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
45563  }
45564  return res;
45565 }
45566 #endif
45567 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
45568  Py_ssize_t i, n;
45569  assert(PyExceptionClass_Check(exc_type));
45570  n = PyTuple_GET_SIZE(tuple);
45571 #if PY_MAJOR_VERSION >= 3
45572  for (i=0; i<n; i++) {
45573  if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
45574  }
45575 #endif
45576  for (i=0; i<n; i++) {
45577  PyObject *t = PyTuple_GET_ITEM(tuple, i);
45578  #if PY_MAJOR_VERSION < 3
45579  if (likely(exc_type == t)) return 1;
45580  #endif
45581  if (likely(PyExceptionClass_Check(t))) {
45582  if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
45583  } else {
45584  }
45585  }
45586  return 0;
45587 }
45588 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
45589  if (likely(err == exc_type)) return 1;
45590  if (likely(PyExceptionClass_Check(err))) {
45591  if (likely(PyExceptionClass_Check(exc_type))) {
45592  return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
45593  } else if (likely(PyTuple_Check(exc_type))) {
45594  return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
45595  } else {
45596  }
45597  }
45598  return PyErr_GivenExceptionMatches(err, exc_type);
45599 }
45600 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
45601  assert(PyExceptionClass_Check(exc_type1));
45602  assert(PyExceptionClass_Check(exc_type2));
45603  if (likely(err == exc_type1 || err == exc_type2)) return 1;
45604  if (likely(PyExceptionClass_Check(err))) {
45605  return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
45606  }
45607  return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
45608 }
45609 #endif
45610 
45611 /* None */
45612 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
45613  PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
45614 }
45615 
45616 /* HasAttr */
45617 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
45618  PyObject *r;
45619  if (unlikely(!__Pyx_PyBaseString_Check(n))) {
45620  PyErr_SetString(PyExc_TypeError,
45621  "hasattr(): attribute name must be string");
45622  return -1;
45623  }
45624  r = __Pyx_GetAttr(o, n);
45625  if (unlikely(!r)) {
45626  PyErr_Clear();
45627  return 0;
45628  } else {
45629  Py_DECREF(r);
45630  return 1;
45631  }
45632 }
45633 
45634 /* StringJoin */
45635 #if !CYTHON_COMPILING_IN_CPYTHON
45636 static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) {
45637  return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL);
45638 }
45639 #endif
45640 
45641 /* PyObject_GenericGetAttrNoDict */
45642 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
45643 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
45644  PyErr_Format(PyExc_AttributeError,
45645 #if PY_MAJOR_VERSION >= 3
45646  "'%.50s' object has no attribute '%U'",
45647  tp->tp_name, attr_name);
45648 #else
45649  "'%.50s' object has no attribute '%.400s'",
45650  tp->tp_name, PyString_AS_STRING(attr_name));
45651 #endif
45652  return NULL;
45653 }
45654 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
45655  PyObject *descr;
45656  PyTypeObject *tp = Py_TYPE(obj);
45657  if (unlikely(!PyString_Check(attr_name))) {
45658  return PyObject_GenericGetAttr(obj, attr_name);
45659  }
45660  assert(!tp->tp_dictoffset);
45661  descr = _PyType_Lookup(tp, attr_name);
45662  if (unlikely(!descr)) {
45663  return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
45664  }
45665  Py_INCREF(descr);
45666  #if PY_MAJOR_VERSION < 3
45667  if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
45668  #endif
45669  {
45670  descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
45671  if (unlikely(f)) {
45672  PyObject *res = f(descr, obj, (PyObject *)tp);
45673  Py_DECREF(descr);
45674  return res;
45675  }
45676  }
45677  return descr;
45678 }
45679 #endif
45680 
45681 /* PyObject_GenericGetAttr */
45682 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
45683 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
45684  if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
45685  return PyObject_GenericGetAttr(obj, attr_name);
45686  }
45687  return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
45688 }
45689 #endif
45690 
45691 /* SetVTable */
45692 static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
45693 #if PY_VERSION_HEX >= 0x02070000
45694  PyObject *ob = PyCapsule_New(vtable, 0, 0);
45695 #else
45696  PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
45697 #endif
45698  if (!ob)
45699  goto bad;
45700  if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
45701  goto bad;
45702  Py_DECREF(ob);
45703  return 0;
45704 bad:
45705  Py_XDECREF(ob);
45706  return -1;
45707 }
45708 
45709 /* SetupReduce */
45710 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
45711  int ret;
45712  PyObject *name_attr;
45713  name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
45714  if (likely(name_attr)) {
45715  ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
45716  } else {
45717  ret = -1;
45718  }
45719  if (unlikely(ret < 0)) {
45720  PyErr_Clear();
45721  ret = 0;
45722  }
45723  Py_XDECREF(name_attr);
45724  return ret;
45725 }
45726 static int __Pyx_setup_reduce(PyObject* type_obj) {
45727  int ret = 0;
45728  PyObject *object_reduce = NULL;
45729  PyObject *object_reduce_ex = NULL;
45730  PyObject *reduce = NULL;
45731  PyObject *reduce_ex = NULL;
45732  PyObject *reduce_cython = NULL;
45733  PyObject *setstate = NULL;
45734  PyObject *setstate_cython = NULL;
45735 #if CYTHON_USE_PYTYPE_LOOKUP
45736  if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
45737 #else
45738  if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
45739 #endif
45740 #if CYTHON_USE_PYTYPE_LOOKUP
45741  object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
45742 #else
45743  object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
45744 #endif
45745  reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
45746  if (reduce_ex == object_reduce_ex) {
45747 #if CYTHON_USE_PYTYPE_LOOKUP
45748  object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
45749 #else
45750  object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
45751 #endif
45752  reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
45753  if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
45754  reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_cython); if (unlikely(!reduce_cython)) goto __PYX_BAD;
45755  ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
45756  ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
45757  setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
45758  if (!setstate) PyErr_Clear();
45759  if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
45760  setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate_cython); if (unlikely(!setstate_cython)) goto __PYX_BAD;
45761  ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
45762  ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
45763  }
45764  PyType_Modified((PyTypeObject*)type_obj);
45765  }
45766  }
45767  goto __PYX_GOOD;
45768 __PYX_BAD:
45769  if (!PyErr_Occurred())
45770  PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
45771  ret = -1;
45772 __PYX_GOOD:
45773 #if !CYTHON_USE_PYTYPE_LOOKUP
45774  Py_XDECREF(object_reduce);
45775  Py_XDECREF(object_reduce_ex);
45776 #endif
45777  Py_XDECREF(reduce);
45778  Py_XDECREF(reduce_ex);
45779  Py_XDECREF(reduce_cython);
45780  Py_XDECREF(setstate);
45781  Py_XDECREF(setstate_cython);
45782  return ret;
45783 }
45784 
45785 /* TypeImport */
45786 #ifndef __PYX_HAVE_RT_ImportType
45787 #define __PYX_HAVE_RT_ImportType
45788 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
45789  size_t size, enum __Pyx_ImportType_CheckSize check_size)
45790 {
45791  PyObject *result = 0;
45792  char warning[200];
45793  Py_ssize_t basicsize;
45794 #ifdef Py_LIMITED_API
45795  PyObject *py_basicsize;
45796 #endif
45797  result = PyObject_GetAttrString(module, class_name);
45798  if (!result)
45799  goto bad;
45800  if (!PyType_Check(result)) {
45801  PyErr_Format(PyExc_TypeError,
45802  "%.200s.%.200s is not a type object",
45803  module_name, class_name);
45804  goto bad;
45805  }
45806 #ifndef Py_LIMITED_API
45807  basicsize = ((PyTypeObject *)result)->tp_basicsize;
45808 #else
45809  py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
45810  if (!py_basicsize)
45811  goto bad;
45812  basicsize = PyLong_AsSsize_t(py_basicsize);
45813  Py_DECREF(py_basicsize);
45814  py_basicsize = 0;
45815  if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
45816  goto bad;
45817 #endif
45818  if ((size_t)basicsize < size) {
45819  PyErr_Format(PyExc_ValueError,
45820  "%.200s.%.200s size changed, may indicate binary incompatibility. "
45821  "Expected %zd from C header, got %zd from PyObject",
45822  module_name, class_name, size, basicsize);
45823  goto bad;
45824  }
45825  if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
45826  PyErr_Format(PyExc_ValueError,
45827  "%.200s.%.200s size changed, may indicate binary incompatibility. "
45828  "Expected %zd from C header, got %zd from PyObject",
45829  module_name, class_name, size, basicsize);
45830  goto bad;
45831  }
45832  else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
45833  PyOS_snprintf(warning, sizeof(warning),
45834  "%s.%s size changed, may indicate binary incompatibility. "
45835  "Expected %zd from C header, got %zd from PyObject",
45836  module_name, class_name, size, basicsize);
45837  if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
45838  }
45839  return (PyTypeObject *)result;
45840 bad:
45841  Py_XDECREF(result);
45842  return NULL;
45843 }
45844 #endif
45845 
45846 /* CLineInTraceback */
45847 #ifndef CYTHON_CLINE_IN_TRACEBACK
45848 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
45849  PyObject *use_cline;
45850  PyObject *ptype, *pvalue, *ptraceback;
45851 #if CYTHON_COMPILING_IN_CPYTHON
45852  PyObject **cython_runtime_dict;
45853 #endif
45854  if (unlikely(!__pyx_cython_runtime)) {
45855  return c_line;
45856  }
45857  __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
45858 #if CYTHON_COMPILING_IN_CPYTHON
45859  cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
45860  if (likely(cython_runtime_dict)) {
45861  __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
45862  use_cline, *cython_runtime_dict,
45863  __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
45864  } else
45865 #endif
45866  {
45867  PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
45868  if (use_cline_obj) {
45869  use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
45870  Py_DECREF(use_cline_obj);
45871  } else {
45872  PyErr_Clear();
45873  use_cline = NULL;
45874  }
45875  }
45876  if (!use_cline) {
45877  c_line = 0;
45878  PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
45879  }
45880  else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
45881  c_line = 0;
45882  }
45883  __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
45884  return c_line;
45885 }
45886 #endif
45887 
45888 /* CodeObjectCache */
45889 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
45890  int start = 0, mid = 0, end = count - 1;
45891  if (end >= 0 && code_line > entries[end].code_line) {
45892  return count;
45893  }
45894  while (start < end) {
45895  mid = start + (end - start) / 2;
45896  if (code_line < entries[mid].code_line) {
45897  end = mid;
45898  } else if (code_line > entries[mid].code_line) {
45899  start = mid + 1;
45900  } else {
45901  return mid;
45902  }
45903  }
45904  if (code_line <= entries[mid].code_line) {
45905  return mid;
45906  } else {
45907  return mid + 1;
45908  }
45909 }
45910 static PyCodeObject *__pyx_find_code_object(int code_line) {
45911  PyCodeObject* code_object;
45912  int pos;
45913  if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
45914  return NULL;
45915  }
45916  pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
45917  if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
45918  return NULL;
45919  }
45920  code_object = __pyx_code_cache.entries[pos].code_object;
45921  Py_INCREF(code_object);
45922  return code_object;
45923 }
45924 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
45925  int pos, i;
45926  __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
45927  if (unlikely(!code_line)) {
45928  return;
45929  }
45930  if (unlikely(!entries)) {
45931  entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
45932  if (likely(entries)) {
45933  __pyx_code_cache.entries = entries;
45934  __pyx_code_cache.max_count = 64;
45935  __pyx_code_cache.count = 1;
45936  entries[0].code_line = code_line;
45937  entries[0].code_object = code_object;
45938  Py_INCREF(code_object);
45939  }
45940  return;
45941  }
45942  pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
45943  if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
45944  PyCodeObject* tmp = entries[pos].code_object;
45945  entries[pos].code_object = code_object;
45946  Py_DECREF(tmp);
45947  return;
45948  }
45949  if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
45950  int new_max = __pyx_code_cache.max_count + 64;
45951  entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
45952  __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
45953  if (unlikely(!entries)) {
45954  return;
45955  }
45956  __pyx_code_cache.entries = entries;
45957  __pyx_code_cache.max_count = new_max;
45958  }
45959  for (i=__pyx_code_cache.count; i>pos; i--) {
45960  entries[i] = entries[i-1];
45961  }
45962  entries[pos].code_line = code_line;
45963  entries[pos].code_object = code_object;
45964  __pyx_code_cache.count++;
45965  Py_INCREF(code_object);
45966 }
45967 
45968 /* AddTraceback */
45969 #include "compile.h"
45970 #include "frameobject.h"
45971 #include "traceback.h"
45972 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
45973  const char *funcname, int c_line,
45974  int py_line, const char *filename) {
45975  PyCodeObject *py_code = 0;
45976  PyObject *py_srcfile = 0;
45977  PyObject *py_funcname = 0;
45978  #if PY_MAJOR_VERSION < 3
45979  py_srcfile = PyString_FromString(filename);
45980  #else
45981  py_srcfile = PyUnicode_FromString(filename);
45982  #endif
45983  if (!py_srcfile) goto bad;
45984  if (c_line) {
45985  #if PY_MAJOR_VERSION < 3
45986  py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
45987  #else
45988  py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
45989  #endif
45990  }
45991  else {
45992  #if PY_MAJOR_VERSION < 3
45993  py_funcname = PyString_FromString(funcname);
45994  #else
45995  py_funcname = PyUnicode_FromString(funcname);
45996  #endif
45997  }
45998  if (!py_funcname) goto bad;
45999  py_code = __Pyx_PyCode_New(
46000  0,
46001  0,
46002  0,
46003  0,
46004  0,
46005  __pyx_empty_bytes, /*PyObject *code,*/
46006  __pyx_empty_tuple, /*PyObject *consts,*/
46007  __pyx_empty_tuple, /*PyObject *names,*/
46008  __pyx_empty_tuple, /*PyObject *varnames,*/
46009  __pyx_empty_tuple, /*PyObject *freevars,*/
46010  __pyx_empty_tuple, /*PyObject *cellvars,*/
46011  py_srcfile, /*PyObject *filename,*/
46012  py_funcname, /*PyObject *name,*/
46013  py_line,
46014  __pyx_empty_bytes /*PyObject *lnotab*/
46015  );
46016  Py_DECREF(py_srcfile);
46017  Py_DECREF(py_funcname);
46018  return py_code;
46019 bad:
46020  Py_XDECREF(py_srcfile);
46021  Py_XDECREF(py_funcname);
46022  return NULL;
46023 }
46024 static void __Pyx_AddTraceback(const char *funcname, int c_line,
46025  int py_line, const char *filename) {
46026  PyCodeObject *py_code = 0;
46027  PyFrameObject *py_frame = 0;
46028  PyThreadState *tstate = __Pyx_PyThreadState_Current;
46029  if (c_line) {
46030  c_line = __Pyx_CLineForTraceback(tstate, c_line);
46031  }
46032  py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
46033  if (!py_code) {
46034  py_code = __Pyx_CreateCodeObjectForTraceback(
46035  funcname, c_line, py_line, filename);
46036  if (!py_code) goto bad;
46037  __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
46038  }
46039  py_frame = PyFrame_New(
46040  tstate, /*PyThreadState *tstate,*/
46041  py_code, /*PyCodeObject *code,*/
46042  __pyx_d, /*PyObject *globals,*/
46043  0 /*PyObject *locals*/
46044  );
46045  if (!py_frame) goto bad;
46046  __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
46047  PyTraceBack_Here(py_frame);
46048 bad:
46049  Py_XDECREF(py_code);
46050  Py_XDECREF(py_frame);
46051 }
46052 
46053 #if PY_MAJOR_VERSION < 3
46054 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
46055  if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
46056  if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
46057  if (__Pyx_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
46058  if (__Pyx_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
46059  PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
46060  return -1;
46061 }
46062 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
46063  PyObject *obj = view->obj;
46064  if (!obj) return;
46065  if (PyObject_CheckBuffer(obj)) {
46066  PyBuffer_Release(view);
46067  return;
46068  }
46069  if ((0)) {}
46070  else if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view);
46071  view->obj = NULL;
46072  Py_DECREF(obj);
46073 }
46074 #endif
46075 
46076 
46077 /* MemviewSliceIsContig */
46078 static int
46079 __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim)
46080 {
46081  int i, index, step, start;
46082  Py_ssize_t itemsize = mvs.memview->view.itemsize;
46083  if (order == 'F') {
46084  step = 1;
46085  start = 0;
46086  } else {
46087  step = -1;
46088  start = ndim - 1;
46089  }
46090  for (i = 0; i < ndim; i++) {
46091  index = start + step * i;
46092  if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
46093  return 0;
46094  itemsize *= mvs.shape[index];
46095  }
46096  return 1;
46097 }
46098 
46099 /* OverlappingSlices */
46100 static void
46101 __pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
46102  void **out_start, void **out_end,
46103  int ndim, size_t itemsize)
46104 {
46105  char *start, *end;
46106  int i;
46107  start = end = slice->data;
46108  for (i = 0; i < ndim; i++) {
46109  Py_ssize_t stride = slice->strides[i];
46110  Py_ssize_t extent = slice->shape[i];
46111  if (extent == 0) {
46112  *out_start = *out_end = start;
46113  return;
46114  } else {
46115  if (stride > 0)
46116  end += stride * (extent - 1);
46117  else
46118  start += stride * (extent - 1);
46119  }
46120  }
46121  *out_start = start;
46122  *out_end = end + itemsize;
46123 }
46124 static int
46125 __pyx_slices_overlap(__Pyx_memviewslice *slice1,
46126  __Pyx_memviewslice *slice2,
46127  int ndim, size_t itemsize)
46128 {
46129  void *start1, *end1, *start2, *end2;
46130  __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
46131  __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
46132  return (start1 < end2) && (start2 < end1);
46133 }
46134 
46135 /* Capsule */
46136 static CYTHON_INLINE PyObject *
46137 __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
46138 {
46139  PyObject *cobj;
46140 #if PY_VERSION_HEX >= 0x02070000
46141  cobj = PyCapsule_New(p, sig, NULL);
46142 #else
46143  cobj = PyCObject_FromVoidPtr(p, NULL);
46144 #endif
46145  return cobj;
46146 }
46147 
46148 /* IsLittleEndian */
46149 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
46150 {
46151  union {
46152  uint32_t u32;
46153  uint8_t u8[4];
46154  } S;
46155  S.u32 = 0x01020304;
46156  return S.u8[0] == 4;
46157 }
46158 
46159 /* BufferFormatCheck */
46160 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
46161  __Pyx_BufFmt_StackElem* stack,
46162  __Pyx_TypeInfo* type) {
46163  stack[0].field = &ctx->root;
46164  stack[0].parent_offset = 0;
46165  ctx->root.type = type;
46166  ctx->root.name = "buffer dtype";
46167  ctx->root.offset = 0;
46168  ctx->head = stack;
46169  ctx->head->field = &ctx->root;
46170  ctx->fmt_offset = 0;
46171  ctx->head->parent_offset = 0;
46172  ctx->new_packmode = '@';
46173  ctx->enc_packmode = '@';
46174  ctx->new_count = 1;
46175  ctx->enc_count = 0;
46176  ctx->enc_type = 0;
46177  ctx->is_complex = 0;
46178  ctx->is_valid_array = 0;
46179  ctx->struct_alignment = 0;
46180  while (type->typegroup == 'S') {
46181  ++ctx->head;
46182  ctx->head->field = type->fields;
46183  ctx->head->parent_offset = 0;
46184  type = type->fields->type;
46185  }
46186 }
46187 static int __Pyx_BufFmt_ParseNumber(const char** ts) {
46188  int count;
46189  const char* t = *ts;
46190  if (*t < '0' || *t > '9') {
46191  return -1;
46192  } else {
46193  count = *t++ - '0';
46194  while (*t >= '0' && *t <= '9') {
46195  count *= 10;
46196  count += *t++ - '0';
46197  }
46198  }
46199  *ts = t;
46200  return count;
46201 }
46202 static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
46203  int number = __Pyx_BufFmt_ParseNumber(ts);
46204  if (number == -1)
46205  PyErr_Format(PyExc_ValueError,\
46206  "Does not understand character buffer dtype format string ('%c')", **ts);
46207  return number;
46208 }
46209 static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
46210  PyErr_Format(PyExc_ValueError,
46211  "Unexpected format string character: '%c'", ch);
46212 }
46213 static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
46214  switch (ch) {
46215  case '?': return "'bool'";
46216  case 'c': return "'char'";
46217  case 'b': return "'signed char'";
46218  case 'B': return "'unsigned char'";
46219  case 'h': return "'short'";
46220  case 'H': return "'unsigned short'";
46221  case 'i': return "'int'";
46222  case 'I': return "'unsigned int'";
46223  case 'l': return "'long'";
46224  case 'L': return "'unsigned long'";
46225  case 'q': return "'long long'";
46226  case 'Q': return "'unsigned long long'";
46227  case 'f': return (is_complex ? "'complex float'" : "'float'");
46228  case 'd': return (is_complex ? "'complex double'" : "'double'");
46229  case 'g': return (is_complex ? "'complex long double'" : "'long double'");
46230  case 'T': return "a struct";
46231  case 'O': return "Python object";
46232  case 'P': return "a pointer";
46233  case 's': case 'p': return "a string";
46234  case 0: return "end";
46235  default: return "unparseable format string";
46236  }
46237 }
46238 static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
46239  switch (ch) {
46240  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
46241  case 'h': case 'H': return 2;
46242  case 'i': case 'I': case 'l': case 'L': return 4;
46243  case 'q': case 'Q': return 8;
46244  case 'f': return (is_complex ? 8 : 4);
46245  case 'd': return (is_complex ? 16 : 8);
46246  case 'g': {
46247  PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
46248  return 0;
46249  }
46250  case 'O': case 'P': return sizeof(void*);
46251  default:
46252  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
46253  return 0;
46254  }
46255 }
46256 static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
46257  switch (ch) {
46258  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
46259  case 'h': case 'H': return sizeof(short);
46260  case 'i': case 'I': return sizeof(int);
46261  case 'l': case 'L': return sizeof(long);
46262  #ifdef HAVE_LONG_LONG
46263  case 'q': case 'Q': return sizeof(PY_LONG_LONG);
46264  #endif
46265  case 'f': return sizeof(float) * (is_complex ? 2 : 1);
46266  case 'd': return sizeof(double) * (is_complex ? 2 : 1);
46267  case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
46268  case 'O': case 'P': return sizeof(void*);
46269  default: {
46270  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
46271  return 0;
46272  }
46273  }
46274 }
46275 typedef struct { char c; short x; } __Pyx_st_short;
46276 typedef struct { char c; int x; } __Pyx_st_int;
46277 typedef struct { char c; long x; } __Pyx_st_long;
46278 typedef struct { char c; float x; } __Pyx_st_float;
46279 typedef struct { char c; double x; } __Pyx_st_double;
46280 typedef struct { char c; long double x; } __Pyx_st_longdouble;
46281 typedef struct { char c; void *x; } __Pyx_st_void_p;
46282 #ifdef HAVE_LONG_LONG
46283 typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
46284 #endif
46285 static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
46286  switch (ch) {
46287  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
46288  case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
46289  case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
46290  case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
46291 #ifdef HAVE_LONG_LONG
46292  case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
46293 #endif
46294  case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
46295  case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
46296  case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
46297  case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
46298  default:
46299  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
46300  return 0;
46301  }
46302 }
46303 /* These are for computing the padding at the end of the struct to align
46304  on the first member of the struct. This will probably the same as above,
46305  but we don't have any guarantees.
46306  */
46307 typedef struct { short x; char c; } __Pyx_pad_short;
46308 typedef struct { int x; char c; } __Pyx_pad_int;
46309 typedef struct { long x; char c; } __Pyx_pad_long;
46310 typedef struct { float x; char c; } __Pyx_pad_float;
46311 typedef struct { double x; char c; } __Pyx_pad_double;
46312 typedef struct { long double x; char c; } __Pyx_pad_longdouble;
46313 typedef struct { void *x; char c; } __Pyx_pad_void_p;
46314 #ifdef HAVE_LONG_LONG
46315 typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
46316 #endif
46317 static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
46318  switch (ch) {
46319  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
46320  case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
46321  case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
46322  case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
46323 #ifdef HAVE_LONG_LONG
46324  case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
46325 #endif
46326  case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
46327  case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
46328  case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
46329  case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
46330  default:
46331  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
46332  return 0;
46333  }
46334 }
46335 static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
46336  switch (ch) {
46337  case 'c':
46338  return 'H';
46339  case 'b': case 'h': case 'i':
46340  case 'l': case 'q': case 's': case 'p':
46341  return 'I';
46342  case '?': case 'B': case 'H': case 'I': case 'L': case 'Q':
46343  return 'U';
46344  case 'f': case 'd': case 'g':
46345  return (is_complex ? 'C' : 'R');
46346  case 'O':
46347  return 'O';
46348  case 'P':
46349  return 'P';
46350  default: {
46351  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
46352  return 0;
46353  }
46354  }
46355 }
46356 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
46357  if (ctx->head == NULL || ctx->head->field == &ctx->root) {
46358  const char* expected;
46359  const char* quote;
46360  if (ctx->head == NULL) {
46361  expected = "end";
46362  quote = "";
46363  } else {
46364  expected = ctx->head->field->type->name;
46365  quote = "'";
46366  }
46367  PyErr_Format(PyExc_ValueError,
46368  "Buffer dtype mismatch, expected %s%s%s but got %s",
46369  quote, expected, quote,
46370  __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
46371  } else {
46372  __Pyx_StructField* field = ctx->head->field;
46373  __Pyx_StructField* parent = (ctx->head - 1)->field;
46374  PyErr_Format(PyExc_ValueError,
46375  "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
46376  field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
46377  parent->type->name, field->name);
46378  }
46379 }
46380 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
46381  char group;
46382  size_t size, offset, arraysize = 1;
46383  if (ctx->enc_type == 0) return 0;
46384  if (ctx->head->field->type->arraysize[0]) {
46385  int i, ndim = 0;
46386  if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
46387  ctx->is_valid_array = ctx->head->field->type->ndim == 1;
46388  ndim = 1;
46389  if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
46390  PyErr_Format(PyExc_ValueError,
46391  "Expected a dimension of size %zu, got %zu",
46392  ctx->head->field->type->arraysize[0], ctx->enc_count);
46393  return -1;
46394  }
46395  }
46396  if (!ctx->is_valid_array) {
46397  PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
46398  ctx->head->field->type->ndim, ndim);
46399  return -1;
46400  }
46401  for (i = 0; i < ctx->head->field->type->ndim; i++) {
46402  arraysize *= ctx->head->field->type->arraysize[i];
46403  }
46404  ctx->is_valid_array = 0;
46405  ctx->enc_count = 1;
46406  }
46407  group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
46408  do {
46409  __Pyx_StructField* field = ctx->head->field;
46410  __Pyx_TypeInfo* type = field->type;
46411  if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
46412  size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
46413  } else {
46414  size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
46415  }
46416  if (ctx->enc_packmode == '@') {
46417  size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
46418  size_t align_mod_offset;
46419  if (align_at == 0) return -1;
46420  align_mod_offset = ctx->fmt_offset % align_at;
46421  if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
46422  if (ctx->struct_alignment == 0)
46423  ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
46424  ctx->is_complex);
46425  }
46426  if (type->size != size || type->typegroup != group) {
46427  if (type->typegroup == 'C' && type->fields != NULL) {
46428  size_t parent_offset = ctx->head->parent_offset + field->offset;
46429  ++ctx->head;
46430  ctx->head->field = type->fields;
46431  ctx->head->parent_offset = parent_offset;
46432  continue;
46433  }
46434  if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
46435  } else {
46436  __Pyx_BufFmt_RaiseExpected(ctx);
46437  return -1;
46438  }
46439  }
46440  offset = ctx->head->parent_offset + field->offset;
46441  if (ctx->fmt_offset != offset) {
46442  PyErr_Format(PyExc_ValueError,
46443  "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
46444  (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
46445  return -1;
46446  }
46447  ctx->fmt_offset += size;
46448  if (arraysize)
46449  ctx->fmt_offset += (arraysize - 1) * size;
46450  --ctx->enc_count;
46451  while (1) {
46452  if (field == &ctx->root) {
46453  ctx->head = NULL;
46454  if (ctx->enc_count != 0) {
46455  __Pyx_BufFmt_RaiseExpected(ctx);
46456  return -1;
46457  }
46458  break;
46459  }
46460  ctx->head->field = ++field;
46461  if (field->type == NULL) {
46462  --ctx->head;
46463  field = ctx->head->field;
46464  continue;
46465  } else if (field->type->typegroup == 'S') {
46466  size_t parent_offset = ctx->head->parent_offset + field->offset;
46467  if (field->type->fields->type == NULL) continue;
46468  field = field->type->fields;
46469  ++ctx->head;
46470  ctx->head->field = field;
46471  ctx->head->parent_offset = parent_offset;
46472  break;
46473  } else {
46474  break;
46475  }
46476  }
46477  } while (ctx->enc_count);
46478  ctx->enc_type = 0;
46479  ctx->is_complex = 0;
46480  return 0;
46481 }
46482 static PyObject *
46483 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
46484 {
46485  const char *ts = *tsp;
46486  int i = 0, number;
46487  int ndim = ctx->head->field->type->ndim;
46488 ;
46489  ++ts;
46490  if (ctx->new_count != 1) {
46491  PyErr_SetString(PyExc_ValueError,
46492  "Cannot handle repeated arrays in format string");
46493  return NULL;
46494  }
46495  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
46496  while (*ts && *ts != ')') {
46497  switch (*ts) {
46498  case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue;
46499  default: break;
46500  }
46501  number = __Pyx_BufFmt_ExpectNumber(&ts);
46502  if (number == -1) return NULL;
46503  if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
46504  return PyErr_Format(PyExc_ValueError,
46505  "Expected a dimension of size %zu, got %d",
46506  ctx->head->field->type->arraysize[i], number);
46507  if (*ts != ',' && *ts != ')')
46508  return PyErr_Format(PyExc_ValueError,
46509  "Expected a comma in format string, got '%c'", *ts);
46510  if (*ts == ',') ts++;
46511  i++;
46512  }
46513  if (i != ndim)
46514  return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
46515  ctx->head->field->type->ndim, i);
46516  if (!*ts) {
46517  PyErr_SetString(PyExc_ValueError,
46518  "Unexpected end of format string, expected ')'");
46519  return NULL;
46520  }
46521  ctx->is_valid_array = 1;
46522  ctx->new_count = 1;
46523  *tsp = ++ts;
46524  return Py_None;
46525 }
46526 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
46527  int got_Z = 0;
46528  while (1) {
46529  switch(*ts) {
46530  case 0:
46531  if (ctx->enc_type != 0 && ctx->head == NULL) {
46532  __Pyx_BufFmt_RaiseExpected(ctx);
46533  return NULL;
46534  }
46535  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
46536  if (ctx->head != NULL) {
46537  __Pyx_BufFmt_RaiseExpected(ctx);
46538  return NULL;
46539  }
46540  return ts;
46541  case ' ':
46542  case '\r':
46543  case '\n':
46544  ++ts;
46545  break;
46546  case '<':
46547  if (!__Pyx_Is_Little_Endian()) {
46548  PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
46549  return NULL;
46550  }
46551  ctx->new_packmode = '=';
46552  ++ts;
46553  break;
46554  case '>':
46555  case '!':
46556  if (__Pyx_Is_Little_Endian()) {
46557  PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
46558  return NULL;
46559  }
46560  ctx->new_packmode = '=';
46561  ++ts;
46562  break;
46563  case '=':
46564  case '@':
46565  case '^':
46566  ctx->new_packmode = *ts++;
46567  break;
46568  case 'T':
46569  {
46570  const char* ts_after_sub;
46571  size_t i, struct_count = ctx->new_count;
46572  size_t struct_alignment = ctx->struct_alignment;
46573  ctx->new_count = 1;
46574  ++ts;
46575  if (*ts != '{') {
46576  PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
46577  return NULL;
46578  }
46579  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
46580  ctx->enc_type = 0;
46581  ctx->enc_count = 0;
46582  ctx->struct_alignment = 0;
46583  ++ts;
46584  ts_after_sub = ts;
46585  for (i = 0; i != struct_count; ++i) {
46586  ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
46587  if (!ts_after_sub) return NULL;
46588  }
46589  ts = ts_after_sub;
46590  if (struct_alignment) ctx->struct_alignment = struct_alignment;
46591  }
46592  break;
46593  case '}':
46594  {
46595  size_t alignment = ctx->struct_alignment;
46596  ++ts;
46597  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
46598  ctx->enc_type = 0;
46599  if (alignment && ctx->fmt_offset % alignment) {
46600  ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
46601  }
46602  }
46603  return ts;
46604  case 'x':
46605  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
46606  ctx->fmt_offset += ctx->new_count;
46607  ctx->new_count = 1;
46608  ctx->enc_count = 0;
46609  ctx->enc_type = 0;
46610  ctx->enc_packmode = ctx->new_packmode;
46611  ++ts;
46612  break;
46613  case 'Z':
46614  got_Z = 1;
46615  ++ts;
46616  if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
46617  __Pyx_BufFmt_RaiseUnexpectedChar('Z');
46618  return NULL;
46619  }
46620  CYTHON_FALLTHROUGH;
46621  case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
46622  case 'l': case 'L': case 'q': case 'Q':
46623  case 'f': case 'd': case 'g':
46624  case 'O': case 'p':
46625  if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
46626  ctx->enc_packmode == ctx->new_packmode) {
46627  ctx->enc_count += ctx->new_count;
46628  ctx->new_count = 1;
46629  got_Z = 0;
46630  ++ts;
46631  break;
46632  }
46633  CYTHON_FALLTHROUGH;
46634  case 's':
46635  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
46636  ctx->enc_count = ctx->new_count;
46637  ctx->enc_packmode = ctx->new_packmode;
46638  ctx->enc_type = *ts;
46639  ctx->is_complex = got_Z;
46640  ++ts;
46641  ctx->new_count = 1;
46642  got_Z = 0;
46643  break;
46644  case ':':
46645  ++ts;
46646  while(*ts != ':') ++ts;
46647  ++ts;
46648  break;
46649  case '(':
46650  if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
46651  break;
46652  default:
46653  {
46654  int number = __Pyx_BufFmt_ExpectNumber(&ts);
46655  if (number == -1) return NULL;
46656  ctx->new_count = (size_t)number;
46657  }
46658  }
46659  }
46660 }
46661 
46662 /* TypeInfoCompare */
46663  static int
46664 __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
46665 {
46666  int i;
46667  if (!a || !b)
46668  return 0;
46669  if (a == b)
46670  return 1;
46671  if (a->size != b->size || a->typegroup != b->typegroup ||
46672  a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
46673  if (a->typegroup == 'H' || b->typegroup == 'H') {
46674  return a->size == b->size;
46675  } else {
46676  return 0;
46677  }
46678  }
46679  if (a->ndim) {
46680  for (i = 0; i < a->ndim; i++)
46681  if (a->arraysize[i] != b->arraysize[i])
46682  return 0;
46683  }
46684  if (a->typegroup == 'S') {
46685  if (a->flags != b->flags)
46686  return 0;
46687  if (a->fields || b->fields) {
46688  if (!(a->fields && b->fields))
46689  return 0;
46690  for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
46691  __Pyx_StructField *field_a = a->fields + i;
46692  __Pyx_StructField *field_b = b->fields + i;
46693  if (field_a->offset != field_b->offset ||
46694  !__pyx_typeinfo_cmp(field_a->type, field_b->type))
46695  return 0;
46696  }
46697  return !a->fields[i].type && !b->fields[i].type;
46698  }
46699  }
46700  return 1;
46701 }
46702 
46703 /* MemviewSliceValidateAndInit */
46704  static int
46705 __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
46706 {
46707  if (buf->shape[dim] <= 1)
46708  return 1;
46709  if (buf->strides) {
46710  if (spec & __Pyx_MEMVIEW_CONTIG) {
46711  if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
46712  if (buf->strides[dim] != sizeof(void *)) {
46713  PyErr_Format(PyExc_ValueError,
46714  "Buffer is not indirectly contiguous "
46715  "in dimension %d.", dim);
46716  goto fail;
46717  }
46718  } else if (buf->strides[dim] != buf->itemsize) {
46719  PyErr_SetString(PyExc_ValueError,
46720  "Buffer and memoryview are not contiguous "
46721  "in the same dimension.");
46722  goto fail;
46723  }
46724  }
46725  if (spec & __Pyx_MEMVIEW_FOLLOW) {
46726  Py_ssize_t stride = buf->strides[dim];
46727  if (stride < 0)
46728  stride = -stride;
46729  if (stride < buf->itemsize) {
46730  PyErr_SetString(PyExc_ValueError,
46731  "Buffer and memoryview are not contiguous "
46732  "in the same dimension.");
46733  goto fail;
46734  }
46735  }
46736  } else {
46737  if (spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1) {
46738  PyErr_Format(PyExc_ValueError,
46739  "C-contiguous buffer is not contiguous in "
46740  "dimension %d", dim);
46741  goto fail;
46742  } else if (spec & (__Pyx_MEMVIEW_PTR)) {
46743  PyErr_Format(PyExc_ValueError,
46744  "C-contiguous buffer is not indirect in "
46745  "dimension %d", dim);
46746  goto fail;
46747  } else if (buf->suboffsets) {
46748  PyErr_SetString(PyExc_ValueError,
46749  "Buffer exposes suboffsets but no strides");
46750  goto fail;
46751  }
46752  }
46753  return 1;
46754 fail:
46755  return 0;
46756 }
46757 static int
46758 __pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec)
46759 {
46760  if (spec & __Pyx_MEMVIEW_DIRECT) {
46761  if (buf->suboffsets && buf->suboffsets[dim] >= 0) {
46762  PyErr_Format(PyExc_ValueError,
46763  "Buffer not compatible with direct access "
46764  "in dimension %d.", dim);
46765  goto fail;
46766  }
46767  }
46768  if (spec & __Pyx_MEMVIEW_PTR) {
46769  if (!buf->suboffsets || (buf->suboffsets[dim] < 0)) {
46770  PyErr_Format(PyExc_ValueError,
46771  "Buffer is not indirectly accessible "
46772  "in dimension %d.", dim);
46773  goto fail;
46774  }
46775  }
46776  return 1;
46777 fail:
46778  return 0;
46779 }
46780 static int
46781 __pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
46782 {
46783  int i;
46784  if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
46785  Py_ssize_t stride = 1;
46786  for (i = 0; i < ndim; i++) {
46787  if (stride * buf->itemsize != buf->strides[i] &&
46788  buf->shape[i] > 1)
46789  {
46790  PyErr_SetString(PyExc_ValueError,
46791  "Buffer not fortran contiguous.");
46792  goto fail;
46793  }
46794  stride = stride * buf->shape[i];
46795  }
46796  } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
46797  Py_ssize_t stride = 1;
46798  for (i = ndim - 1; i >- 1; i--) {
46799  if (stride * buf->itemsize != buf->strides[i] &&
46800  buf->shape[i] > 1) {
46801  PyErr_SetString(PyExc_ValueError,
46802  "Buffer not C contiguous.");
46803  goto fail;
46804  }
46805  stride = stride * buf->shape[i];
46806  }
46807  }
46808  return 1;
46809 fail:
46810  return 0;
46811 }
46812 static int __Pyx_ValidateAndInit_memviewslice(
46813  int *axes_specs,
46814  int c_or_f_flag,
46815  int buf_flags,
46816  int ndim,
46817  __Pyx_TypeInfo *dtype,
46818  __Pyx_BufFmt_StackElem stack[],
46819  __Pyx_memviewslice *memviewslice,
46820  PyObject *original_obj)
46821 {
46822  struct __pyx_memoryview_obj *memview, *new_memview;
46823  __Pyx_RefNannyDeclarations
46824  Py_buffer *buf;
46825  int i, spec = 0, retval = -1;
46826  __Pyx_BufFmt_Context ctx;
46827  int from_memoryview = __pyx_memoryview_check(original_obj);
46828  __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
46829  if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
46830  original_obj)->typeinfo)) {
46831  memview = (struct __pyx_memoryview_obj *) original_obj;
46832  new_memview = NULL;
46833  } else {
46834  memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
46835  original_obj, buf_flags, 0, dtype);
46836  new_memview = memview;
46837  if (unlikely(!memview))
46838  goto fail;
46839  }
46840  buf = &memview->view;
46841  if (buf->ndim != ndim) {
46842  PyErr_Format(PyExc_ValueError,
46843  "Buffer has wrong number of dimensions (expected %d, got %d)",
46844  ndim, buf->ndim);
46845  goto fail;
46846  }
46847  if (new_memview) {
46848  __Pyx_BufFmt_Init(&ctx, stack, dtype);
46849  if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
46850  }
46851  if ((unsigned) buf->itemsize != dtype->size) {
46852  PyErr_Format(PyExc_ValueError,
46853  "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
46854  "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
46855  buf->itemsize,
46856  (buf->itemsize > 1) ? "s" : "",
46857  dtype->name,
46858  dtype->size,
46859  (dtype->size > 1) ? "s" : "");
46860  goto fail;
46861  }
46862  for (i = 0; i < ndim; i++) {
46863  spec = axes_specs[i];
46864  if (!__pyx_check_strides(buf, i, ndim, spec))
46865  goto fail;
46866  if (!__pyx_check_suboffsets(buf, i, ndim, spec))
46867  goto fail;
46868  }
46869  if (buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag))
46870  goto fail;
46871  if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
46872  new_memview != NULL) == -1)) {
46873  goto fail;
46874  }
46875  retval = 0;
46876  goto no_fail;
46877 fail:
46878  Py_XDECREF(new_memview);
46879  retval = -1;
46880 no_fail:
46881  __Pyx_RefNannyFinishContext();
46882  return retval;
46883 }
46884 
46885 /* ObjectToMemviewSlice */
46886  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_double(PyObject *obj, int writable_flag) {
46887  __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
46888  __Pyx_BufFmt_StackElem stack[1];
46889  int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
46890  int retcode;
46891  if (obj == Py_None) {
46892  result.memview = (struct __pyx_memoryview_obj *) Py_None;
46893  return result;
46894  }
46895  retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
46896  PyBUF_RECORDS_RO | writable_flag, 2,
46897  &__Pyx_TypeInfo_double, stack,
46898  &result, obj);
46899  if (unlikely(retcode == -1))
46900  goto __pyx_fail;
46901  return result;
46902 __pyx_fail:
46903  result.memview = NULL;
46904  result.data = NULL;
46905  return result;
46906 }
46907 
46908 /* ObjectToMemviewSlice */
46909  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_int(PyObject *obj, int writable_flag) {
46910  __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
46911  __Pyx_BufFmt_StackElem stack[1];
46912  int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
46913  int retcode;
46914  if (obj == Py_None) {
46915  result.memview = (struct __pyx_memoryview_obj *) Py_None;
46916  return result;
46917  }
46918  retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
46919  PyBUF_RECORDS_RO | writable_flag, 1,
46920  &__Pyx_TypeInfo_int, stack,
46921  &result, obj);
46922  if (unlikely(retcode == -1))
46923  goto __pyx_fail;
46924  return result;
46925 __pyx_fail:
46926  result.memview = NULL;
46927  result.data = NULL;
46928  return result;
46929 }
46930 
46931 /* CIntFromPyVerify */
46932  #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
46933  __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
46934 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
46935  __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
46936 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
46937  {\
46938  func_type value = func_value;\
46939  if (sizeof(target_type) < sizeof(func_type)) {\
46940  if (unlikely(value != (func_type) (target_type) value)) {\
46941  func_type zero = 0;\
46942  if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
46943  return (target_type) -1;\
46944  if (is_unsigned && unlikely(value < zero))\
46945  goto raise_neg_overflow;\
46946  else\
46947  goto raise_overflow;\
46948  }\
46949  }\
46950  return (target_type) value;\
46951  }
46952 
46953 /* ObjectToMemviewSlice */
46954  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_double(PyObject *obj, int writable_flag) {
46955  __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
46956  __Pyx_BufFmt_StackElem stack[1];
46957  int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
46958  int retcode;
46959  if (obj == Py_None) {
46960  result.memview = (struct __pyx_memoryview_obj *) Py_None;
46961  return result;
46962  }
46963  retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
46964  PyBUF_RECORDS_RO | writable_flag, 1,
46965  &__Pyx_TypeInfo_double, stack,
46966  &result, obj);
46967  if (unlikely(retcode == -1))
46968  goto __pyx_fail;
46969  return result;
46970 __pyx_fail:
46971  result.memview = NULL;
46972  result.data = NULL;
46973  return result;
46974 }
46975 
46976 /* ObjectToMemviewSlice */
46977  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_int(PyObject *obj, int writable_flag) {
46978  __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
46979  __Pyx_BufFmt_StackElem stack[1];
46980  int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
46981  int retcode;
46982  if (obj == Py_None) {
46983  result.memview = (struct __pyx_memoryview_obj *) Py_None;
46984  return result;
46985  }
46986  retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
46987  PyBUF_RECORDS_RO | writable_flag, 2,
46988  &__Pyx_TypeInfo_int, stack,
46989  &result, obj);
46990  if (unlikely(retcode == -1))
46991  goto __pyx_fail;
46992  return result;
46993 __pyx_fail:
46994  result.memview = NULL;
46995  result.data = NULL;
46996  return result;
46997 }
46998 
46999 /* ObjectToMemviewSlice */
47000  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(PyObject *obj, int writable_flag) {
47001  __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
47002  __Pyx_BufFmt_StackElem stack[1];
47003  int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
47004  int retcode;
47005  if (obj == Py_None) {
47006  result.memview = (struct __pyx_memoryview_obj *) Py_None;
47007  return result;
47008  }
47009  retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
47010  PyBUF_RECORDS_RO | writable_flag, 4,
47011  &__Pyx_TypeInfo_double, stack,
47012  &result, obj);
47013  if (unlikely(retcode == -1))
47014  goto __pyx_fail;
47015  return result;
47016 __pyx_fail:
47017  result.memview = NULL;
47018  result.data = NULL;
47019  return result;
47020 }
47021 
47022 /* ObjectToMemviewSlice */
47023  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(PyObject *obj, int writable_flag) {
47024  __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
47025  __Pyx_BufFmt_StackElem stack[1];
47026  int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
47027  int retcode;
47028  if (obj == Py_None) {
47029  result.memview = (struct __pyx_memoryview_obj *) Py_None;
47030  return result;
47031  }
47032  retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
47033  PyBUF_RECORDS_RO | writable_flag, 3,
47034  &__Pyx_TypeInfo_double, stack,
47035  &result, obj);
47036  if (unlikely(retcode == -1))
47037  goto __pyx_fail;
47038  return result;
47039 __pyx_fail:
47040  result.memview = NULL;
47041  result.data = NULL;
47042  return result;
47043 }
47044 
47045 /* MemviewDtypeToObject */
47046  static CYTHON_INLINE PyObject *__pyx_memview_get_double(const char *itemp) {
47047  return (PyObject *) PyFloat_FromDouble(*(double *) itemp);
47048 }
47049 static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *obj) {
47050  double value = __pyx_PyFloat_AsDouble(obj);
47051  if ((value == (double)-1) && PyErr_Occurred())
47052  return 0;
47053  *(double *) itemp = value;
47054  return 1;
47055 }
47056 
47057 /* CIntToPy */
47058  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
47059  const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
47060  const int is_unsigned = neg_one > const_zero;
47061  if (is_unsigned) {
47062  if (sizeof(int) < sizeof(long)) {
47063  return PyInt_FromLong((long) value);
47064  } else if (sizeof(int) <= sizeof(unsigned long)) {
47065  return PyLong_FromUnsignedLong((unsigned long) value);
47066 #ifdef HAVE_LONG_LONG
47067  } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
47068  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
47069 #endif
47070  }
47071  } else {
47072  if (sizeof(int) <= sizeof(long)) {
47073  return PyInt_FromLong((long) value);
47074 #ifdef HAVE_LONG_LONG
47075  } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
47076  return PyLong_FromLongLong((PY_LONG_LONG) value);
47077 #endif
47078  }
47079  }
47080  {
47081  int one = 1; int little = (int)*(unsigned char *)&one;
47082  unsigned char *bytes = (unsigned char *)&value;
47083  return _PyLong_FromByteArray(bytes, sizeof(int),
47084  little, !is_unsigned);
47085  }
47086 }
47087 
47088 /* MemviewDtypeToObject */
47089  static CYTHON_INLINE PyObject *__pyx_memview_get_int(const char *itemp) {
47090  return (PyObject *) __Pyx_PyInt_From_int(*(int *) itemp);
47091 }
47092 static CYTHON_INLINE int __pyx_memview_set_int(const char *itemp, PyObject *obj) {
47093  int value = __Pyx_PyInt_As_int(obj);
47094  if ((value == (int)-1) && PyErr_Occurred())
47095  return 0;
47096  *(int *) itemp = value;
47097  return 1;
47098 }
47099 
47100 /* CIntToPy */
47101  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
47102  const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
47103  const int is_unsigned = neg_one > const_zero;
47104  if (is_unsigned) {
47105  if (sizeof(long) < sizeof(long)) {
47106  return PyInt_FromLong((long) value);
47107  } else if (sizeof(long) <= sizeof(unsigned long)) {
47108  return PyLong_FromUnsignedLong((unsigned long) value);
47109 #ifdef HAVE_LONG_LONG
47110  } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
47111  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
47112 #endif
47113  }
47114  } else {
47115  if (sizeof(long) <= sizeof(long)) {
47116  return PyInt_FromLong((long) value);
47117 #ifdef HAVE_LONG_LONG
47118  } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
47119  return PyLong_FromLongLong((PY_LONG_LONG) value);
47120 #endif
47121  }
47122  }
47123  {
47124  int one = 1; int little = (int)*(unsigned char *)&one;
47125  unsigned char *bytes = (unsigned char *)&value;
47126  return _PyLong_FromByteArray(bytes, sizeof(long),
47127  little, !is_unsigned);
47128  }
47129 }
47130 
47131 /* Declarations */
47132  #if CYTHON_CCOMPLEX
47133  #ifdef __cplusplus
47134  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
47135  return ::std::complex< float >(x, y);
47136  }
47137  #else
47138  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
47139  return x + y*(__pyx_t_float_complex)_Complex_I;
47140  }
47141  #endif
47142 #else
47143  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
47144  __pyx_t_float_complex z;
47145  z.real = x;
47146  z.imag = y;
47147  return z;
47148  }
47149 #endif
47150 
47151 /* Arithmetic */
47152  #if CYTHON_CCOMPLEX
47153 #else
47154  static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
47155  return (a.real == b.real) && (a.imag == b.imag);
47156  }
47157  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
47158  __pyx_t_float_complex z;
47159  z.real = a.real + b.real;
47160  z.imag = a.imag + b.imag;
47161  return z;
47162  }
47163  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
47164  __pyx_t_float_complex z;
47165  z.real = a.real - b.real;
47166  z.imag = a.imag - b.imag;
47167  return z;
47168  }
47169  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
47170  __pyx_t_float_complex z;
47171  z.real = a.real * b.real - a.imag * b.imag;
47172  z.imag = a.real * b.imag + a.imag * b.real;
47173  return z;
47174  }
47175  #if 1
47176  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
47177  if (b.imag == 0) {
47178  return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
47179  } else if (fabsf(b.real) >= fabsf(b.imag)) {
47180  if (b.real == 0 && b.imag == 0) {
47181  return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
47182  } else {
47183  float r = b.imag / b.real;
47184  float s = (float)(1.0) / (b.real + b.imag * r);
47185  return __pyx_t_float_complex_from_parts(
47186  (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
47187  }
47188  } else {
47189  float r = b.real / b.imag;
47190  float s = (float)(1.0) / (b.imag + b.real * r);
47191  return __pyx_t_float_complex_from_parts(
47192  (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
47193  }
47194  }
47195  #else
47196  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
47197  if (b.imag == 0) {
47198  return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
47199  } else {
47200  float denom = b.real * b.real + b.imag * b.imag;
47201  return __pyx_t_float_complex_from_parts(
47202  (a.real * b.real + a.imag * b.imag) / denom,
47203  (a.imag * b.real - a.real * b.imag) / denom);
47204  }
47205  }
47206  #endif
47207  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
47208  __pyx_t_float_complex z;
47209  z.real = -a.real;
47210  z.imag = -a.imag;
47211  return z;
47212  }
47213  static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
47214  return (a.real == 0) && (a.imag == 0);
47215  }
47216  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
47217  __pyx_t_float_complex z;
47218  z.real = a.real;
47219  z.imag = -a.imag;
47220  return z;
47221  }
47222  #if 1
47223  static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
47224  #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
47225  return sqrtf(z.real*z.real + z.imag*z.imag);
47226  #else
47227  return hypotf(z.real, z.imag);
47228  #endif
47229  }
47230  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
47231  __pyx_t_float_complex z;
47232  float r, lnr, theta, z_r, z_theta;
47233  if (b.imag == 0 && b.real == (int)b.real) {
47234  if (b.real < 0) {
47235  float denom = a.real * a.real + a.imag * a.imag;
47236  a.real = a.real / denom;
47237  a.imag = -a.imag / denom;
47238  b.real = -b.real;
47239  }
47240  switch ((int)b.real) {
47241  case 0:
47242  z.real = 1;
47243  z.imag = 0;
47244  return z;
47245  case 1:
47246  return a;
47247  case 2:
47248  return __Pyx_c_prod_float(a, a);
47249  case 3:
47250  z = __Pyx_c_prod_float(a, a);
47251  return __Pyx_c_prod_float(z, a);
47252  case 4:
47253  z = __Pyx_c_prod_float(a, a);
47254  return __Pyx_c_prod_float(z, z);
47255  }
47256  }
47257  if (a.imag == 0) {
47258  if (a.real == 0) {
47259  return a;
47260  } else if (b.imag == 0) {
47261  z.real = powf(a.real, b.real);
47262  z.imag = 0;
47263  return z;
47264  } else if (a.real > 0) {
47265  r = a.real;
47266  theta = 0;
47267  } else {
47268  r = -a.real;
47269  theta = atan2f(0.0, -1.0);
47270  }
47271  } else {
47272  r = __Pyx_c_abs_float(a);
47273  theta = atan2f(a.imag, a.real);
47274  }
47275  lnr = logf(r);
47276  z_r = expf(lnr * b.real - theta * b.imag);
47277  z_theta = theta * b.real + lnr * b.imag;
47278  z.real = z_r * cosf(z_theta);
47279  z.imag = z_r * sinf(z_theta);
47280  return z;
47281  }
47282  #endif
47283 #endif
47284 
47285 /* Declarations */
47286  #if CYTHON_CCOMPLEX
47287  #ifdef __cplusplus
47288  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
47289  return ::std::complex< double >(x, y);
47290  }
47291  #else
47292  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
47293  return x + y*(__pyx_t_double_complex)_Complex_I;
47294  }
47295  #endif
47296 #else
47297  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
47298  __pyx_t_double_complex z;
47299  z.real = x;
47300  z.imag = y;
47301  return z;
47302  }
47303 #endif
47304 
47305 /* Arithmetic */
47306  #if CYTHON_CCOMPLEX
47307 #else
47308  static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
47309  return (a.real == b.real) && (a.imag == b.imag);
47310  }
47311  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
47312  __pyx_t_double_complex z;
47313  z.real = a.real + b.real;
47314  z.imag = a.imag + b.imag;
47315  return z;
47316  }
47317  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
47318  __pyx_t_double_complex z;
47319  z.real = a.real - b.real;
47320  z.imag = a.imag - b.imag;
47321  return z;
47322  }
47323  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
47324  __pyx_t_double_complex z;
47325  z.real = a.real * b.real - a.imag * b.imag;
47326  z.imag = a.real * b.imag + a.imag * b.real;
47327  return z;
47328  }
47329  #if 1
47330  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
47331  if (b.imag == 0) {
47332  return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
47333  } else if (fabs(b.real) >= fabs(b.imag)) {
47334  if (b.real == 0 && b.imag == 0) {
47335  return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
47336  } else {
47337  double r = b.imag / b.real;
47338  double s = (double)(1.0) / (b.real + b.imag * r);
47339  return __pyx_t_double_complex_from_parts(
47340  (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
47341  }
47342  } else {
47343  double r = b.real / b.imag;
47344  double s = (double)(1.0) / (b.imag + b.real * r);
47345  return __pyx_t_double_complex_from_parts(
47346  (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
47347  }
47348  }
47349  #else
47350  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
47351  if (b.imag == 0) {
47352  return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
47353  } else {
47354  double denom = b.real * b.real + b.imag * b.imag;
47355  return __pyx_t_double_complex_from_parts(
47356  (a.real * b.real + a.imag * b.imag) / denom,
47357  (a.imag * b.real - a.real * b.imag) / denom);
47358  }
47359  }
47360  #endif
47361  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
47362  __pyx_t_double_complex z;
47363  z.real = -a.real;
47364  z.imag = -a.imag;
47365  return z;
47366  }
47367  static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
47368  return (a.real == 0) && (a.imag == 0);
47369  }
47370  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
47371  __pyx_t_double_complex z;
47372  z.real = a.real;
47373  z.imag = -a.imag;
47374  return z;
47375  }
47376  #if 1
47377  static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
47378  #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
47379  return sqrt(z.real*z.real + z.imag*z.imag);
47380  #else
47381  return hypot(z.real, z.imag);
47382  #endif
47383  }
47384  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
47385  __pyx_t_double_complex z;
47386  double r, lnr, theta, z_r, z_theta;
47387  if (b.imag == 0 && b.real == (int)b.real) {
47388  if (b.real < 0) {
47389  double denom = a.real * a.real + a.imag * a.imag;
47390  a.real = a.real / denom;
47391  a.imag = -a.imag / denom;
47392  b.real = -b.real;
47393  }
47394  switch ((int)b.real) {
47395  case 0:
47396  z.real = 1;
47397  z.imag = 0;
47398  return z;
47399  case 1:
47400  return a;
47401  case 2:
47402  return __Pyx_c_prod_double(a, a);
47403  case 3:
47404  z = __Pyx_c_prod_double(a, a);
47405  return __Pyx_c_prod_double(z, a);
47406  case 4:
47407  z = __Pyx_c_prod_double(a, a);
47408  return __Pyx_c_prod_double(z, z);
47409  }
47410  }
47411  if (a.imag == 0) {
47412  if (a.real == 0) {
47413  return a;
47414  } else if (b.imag == 0) {
47415  z.real = pow(a.real, b.real);
47416  z.imag = 0;
47417  return z;
47418  } else if (a.real > 0) {
47419  r = a.real;
47420  theta = 0;
47421  } else {
47422  r = -a.real;
47423  theta = atan2(0.0, -1.0);
47424  }
47425  } else {
47426  r = __Pyx_c_abs_double(a);
47427  theta = atan2(a.imag, a.real);
47428  }
47429  lnr = log(r);
47430  z_r = exp(lnr * b.real - theta * b.imag);
47431  z_theta = theta * b.real + lnr * b.imag;
47432  z.real = z_r * cos(z_theta);
47433  z.imag = z_r * sin(z_theta);
47434  return z;
47435  }
47436  #endif
47437 #endif
47438 
47439 /* CIntToPy */
47440  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) {
47441  const enum NPY_TYPES neg_one = (enum NPY_TYPES) ((enum NPY_TYPES) 0 - (enum NPY_TYPES) 1), const_zero = (enum NPY_TYPES) 0;
47442  const int is_unsigned = neg_one > const_zero;
47443  if (is_unsigned) {
47444  if (sizeof(enum NPY_TYPES) < sizeof(long)) {
47445  return PyInt_FromLong((long) value);
47446  } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) {
47447  return PyLong_FromUnsignedLong((unsigned long) value);
47448 #ifdef HAVE_LONG_LONG
47449  } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) {
47450  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
47451 #endif
47452  }
47453  } else {
47454  if (sizeof(enum NPY_TYPES) <= sizeof(long)) {
47455  return PyInt_FromLong((long) value);
47456 #ifdef HAVE_LONG_LONG
47457  } else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) {
47458  return PyLong_FromLongLong((PY_LONG_LONG) value);
47459 #endif
47460  }
47461  }
47462  {
47463  int one = 1; int little = (int)*(unsigned char *)&one;
47464  unsigned char *bytes = (unsigned char *)&value;
47465  return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES),
47466  little, !is_unsigned);
47467  }
47468 }
47469 
47470 /* MemviewSliceCopyTemplate */
47471  static __Pyx_memviewslice
47472 __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
47473  const char *mode, int ndim,
47474  size_t sizeof_dtype, int contig_flag,
47475  int dtype_is_object)
47476 {
47477  __Pyx_RefNannyDeclarations
47478  int i;
47479  __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } };
47480  struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
47481  Py_buffer *buf = &from_memview->view;
47482  PyObject *shape_tuple = NULL;
47483  PyObject *temp_int = NULL;
47484  struct __pyx_array_obj *array_obj = NULL;
47485  struct __pyx_memoryview_obj *memview_obj = NULL;
47486  __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0);
47487  for (i = 0; i < ndim; i++) {
47488  if (from_mvs->suboffsets[i] >= 0) {
47489  PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with "
47490  "indirect dimensions (axis %d)", i);
47491  goto fail;
47492  }
47493  }
47494  shape_tuple = PyTuple_New(ndim);
47495  if (unlikely(!shape_tuple)) {
47496  goto fail;
47497  }
47498  __Pyx_GOTREF(shape_tuple);
47499  for(i = 0; i < ndim; i++) {
47500  temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
47501  if(unlikely(!temp_int)) {
47502  goto fail;
47503  } else {
47504  PyTuple_SET_ITEM(shape_tuple, i, temp_int);
47505  temp_int = NULL;
47506  }
47507  }
47508  array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (char *) mode, NULL);
47509  if (unlikely(!array_obj)) {
47510  goto fail;
47511  }
47512  __Pyx_GOTREF(array_obj);
47513  memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
47514  (PyObject *) array_obj, contig_flag,
47515  dtype_is_object,
47516  from_mvs->memview->typeinfo);
47517  if (unlikely(!memview_obj))
47518  goto fail;
47519  if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
47520  goto fail;
47521  if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
47522  dtype_is_object) < 0))
47523  goto fail;
47524  goto no_fail;
47525 fail:
47526  __Pyx_XDECREF(new_mvs.memview);
47527  new_mvs.memview = NULL;
47528  new_mvs.data = NULL;
47529 no_fail:
47530  __Pyx_XDECREF(shape_tuple);
47531  __Pyx_XDECREF(temp_int);
47532  __Pyx_XDECREF(array_obj);
47533  __Pyx_RefNannyFinishContext();
47534  return new_mvs;
47535 }
47536 
47537 /* CIntFromPy */
47538  static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
47539  const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
47540  const int is_unsigned = neg_one > const_zero;
47541 #if PY_MAJOR_VERSION < 3
47542  if (likely(PyInt_Check(x))) {
47543  if (sizeof(int) < sizeof(long)) {
47544  __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
47545  } else {
47546  long val = PyInt_AS_LONG(x);
47547  if (is_unsigned && unlikely(val < 0)) {
47548  goto raise_neg_overflow;
47549  }
47550  return (int) val;
47551  }
47552  } else
47553 #endif
47554  if (likely(PyLong_Check(x))) {
47555  if (is_unsigned) {
47556 #if CYTHON_USE_PYLONG_INTERNALS
47557  const digit* digits = ((PyLongObject*)x)->ob_digit;
47558  switch (Py_SIZE(x)) {
47559  case 0: return (int) 0;
47560  case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
47561  case 2:
47562  if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
47563  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
47564  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47565  } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
47566  return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
47567  }
47568  }
47569  break;
47570  case 3:
47571  if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
47572  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
47573  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47574  } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
47575  return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
47576  }
47577  }
47578  break;
47579  case 4:
47580  if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
47581  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
47582  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47583  } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
47584  return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
47585  }
47586  }
47587  break;
47588  }
47589 #endif
47590 #if CYTHON_COMPILING_IN_CPYTHON
47591  if (unlikely(Py_SIZE(x) < 0)) {
47592  goto raise_neg_overflow;
47593  }
47594 #else
47595  {
47596  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
47597  if (unlikely(result < 0))
47598  return (int) -1;
47599  if (unlikely(result == 1))
47600  goto raise_neg_overflow;
47601  }
47602 #endif
47603  if (sizeof(int) <= sizeof(unsigned long)) {
47604  __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
47605 #ifdef HAVE_LONG_LONG
47606  } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
47607  __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
47608 #endif
47609  }
47610  } else {
47611 #if CYTHON_USE_PYLONG_INTERNALS
47612  const digit* digits = ((PyLongObject*)x)->ob_digit;
47613  switch (Py_SIZE(x)) {
47614  case 0: return (int) 0;
47615  case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
47616  case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
47617  case -2:
47618  if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
47619  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
47620  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47621  } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
47622  return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
47623  }
47624  }
47625  break;
47626  case 2:
47627  if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
47628  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
47629  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47630  } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
47631  return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
47632  }
47633  }
47634  break;
47635  case -3:
47636  if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
47637  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
47638  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47639  } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
47640  return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
47641  }
47642  }
47643  break;
47644  case 3:
47645  if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
47646  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
47647  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47648  } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
47649  return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
47650  }
47651  }
47652  break;
47653  case -4:
47654  if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
47655  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
47656  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47657  } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
47658  return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
47659  }
47660  }
47661  break;
47662  case 4:
47663  if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
47664  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
47665  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47666  } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
47667  return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
47668  }
47669  }
47670  break;
47671  }
47672 #endif
47673  if (sizeof(int) <= sizeof(long)) {
47674  __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
47675 #ifdef HAVE_LONG_LONG
47676  } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
47677  __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
47678 #endif
47679  }
47680  }
47681  {
47682 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
47683  PyErr_SetString(PyExc_RuntimeError,
47684  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
47685 #else
47686  int val;
47687  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
47688  #if PY_MAJOR_VERSION < 3
47689  if (likely(v) && !PyLong_Check(v)) {
47690  PyObject *tmp = v;
47691  v = PyNumber_Long(tmp);
47692  Py_DECREF(tmp);
47693  }
47694  #endif
47695  if (likely(v)) {
47696  int one = 1; int is_little = (int)*(unsigned char *)&one;
47697  unsigned char *bytes = (unsigned char *)&val;
47698  int ret = _PyLong_AsByteArray((PyLongObject *)v,
47699  bytes, sizeof(val),
47700  is_little, !is_unsigned);
47701  Py_DECREF(v);
47702  if (likely(!ret))
47703  return val;
47704  }
47705 #endif
47706  return (int) -1;
47707  }
47708  } else {
47709  int val;
47710  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
47711  if (!tmp) return (int) -1;
47712  val = __Pyx_PyInt_As_int(tmp);
47713  Py_DECREF(tmp);
47714  return val;
47715  }
47716 raise_overflow:
47717  PyErr_SetString(PyExc_OverflowError,
47718  "value too large to convert to int");
47719  return (int) -1;
47720 raise_neg_overflow:
47721  PyErr_SetString(PyExc_OverflowError,
47722  "can't convert negative value to int");
47723  return (int) -1;
47724 }
47725 
47726 /* TypeInfoToFormat */
47727  static struct __pyx_typeinfo_string __Pyx_TypeInfoToFormat(__Pyx_TypeInfo *type) {
47728  struct __pyx_typeinfo_string result = { {0} };
47729  char *buf = (char *) result.string;
47730  size_t size = type->size;
47731  switch (type->typegroup) {
47732  case 'H':
47733  *buf = 'c';
47734  break;
47735  case 'I':
47736  case 'U':
47737  if (size == 1)
47738  *buf = (type->is_unsigned) ? 'B' : 'b';
47739  else if (size == 2)
47740  *buf = (type->is_unsigned) ? 'H' : 'h';
47741  else if (size == 4)
47742  *buf = (type->is_unsigned) ? 'I' : 'i';
47743  else if (size == 8)
47744  *buf = (type->is_unsigned) ? 'Q' : 'q';
47745  break;
47746  case 'P':
47747  *buf = 'P';
47748  break;
47749  case 'C':
47750  {
47751  __Pyx_TypeInfo complex_type = *type;
47752  complex_type.typegroup = 'R';
47753  complex_type.size /= 2;
47754  *buf++ = 'Z';
47755  *buf = __Pyx_TypeInfoToFormat(&complex_type).string[0];
47756  break;
47757  }
47758  case 'R':
47759  if (size == 4)
47760  *buf = 'f';
47761  else if (size == 8)
47762  *buf = 'd';
47763  else
47764  *buf = 'g';
47765  break;
47766  }
47767  return result;
47768 }
47769 
47770 /* CIntFromPy */
47771  static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
47772  const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
47773  const int is_unsigned = neg_one > const_zero;
47774 #if PY_MAJOR_VERSION < 3
47775  if (likely(PyInt_Check(x))) {
47776  if (sizeof(long) < sizeof(long)) {
47777  __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
47778  } else {
47779  long val = PyInt_AS_LONG(x);
47780  if (is_unsigned && unlikely(val < 0)) {
47781  goto raise_neg_overflow;
47782  }
47783  return (long) val;
47784  }
47785  } else
47786 #endif
47787  if (likely(PyLong_Check(x))) {
47788  if (is_unsigned) {
47789 #if CYTHON_USE_PYLONG_INTERNALS
47790  const digit* digits = ((PyLongObject*)x)->ob_digit;
47791  switch (Py_SIZE(x)) {
47792  case 0: return (long) 0;
47793  case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
47794  case 2:
47795  if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
47796  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
47797  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47798  } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
47799  return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
47800  }
47801  }
47802  break;
47803  case 3:
47804  if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
47805  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
47806  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47807  } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
47808  return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
47809  }
47810  }
47811  break;
47812  case 4:
47813  if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
47814  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
47815  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47816  } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
47817  return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
47818  }
47819  }
47820  break;
47821  }
47822 #endif
47823 #if CYTHON_COMPILING_IN_CPYTHON
47824  if (unlikely(Py_SIZE(x) < 0)) {
47825  goto raise_neg_overflow;
47826  }
47827 #else
47828  {
47829  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
47830  if (unlikely(result < 0))
47831  return (long) -1;
47832  if (unlikely(result == 1))
47833  goto raise_neg_overflow;
47834  }
47835 #endif
47836  if (sizeof(long) <= sizeof(unsigned long)) {
47837  __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
47838 #ifdef HAVE_LONG_LONG
47839  } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
47840  __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
47841 #endif
47842  }
47843  } else {
47844 #if CYTHON_USE_PYLONG_INTERNALS
47845  const digit* digits = ((PyLongObject*)x)->ob_digit;
47846  switch (Py_SIZE(x)) {
47847  case 0: return (long) 0;
47848  case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
47849  case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
47850  case -2:
47851  if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
47852  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
47853  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47854  } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
47855  return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
47856  }
47857  }
47858  break;
47859  case 2:
47860  if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
47861  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
47862  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47863  } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
47864  return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
47865  }
47866  }
47867  break;
47868  case -3:
47869  if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
47870  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
47871  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47872  } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
47873  return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
47874  }
47875  }
47876  break;
47877  case 3:
47878  if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
47879  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
47880  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47881  } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
47882  return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
47883  }
47884  }
47885  break;
47886  case -4:
47887  if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
47888  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
47889  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47890  } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
47891  return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
47892  }
47893  }
47894  break;
47895  case 4:
47896  if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
47897  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
47898  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47899  } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
47900  return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
47901  }
47902  }
47903  break;
47904  }
47905 #endif
47906  if (sizeof(long) <= sizeof(long)) {
47907  __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
47908 #ifdef HAVE_LONG_LONG
47909  } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
47910  __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
47911 #endif
47912  }
47913  }
47914  {
47915 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
47916  PyErr_SetString(PyExc_RuntimeError,
47917  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
47918 #else
47919  long val;
47920  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
47921  #if PY_MAJOR_VERSION < 3
47922  if (likely(v) && !PyLong_Check(v)) {
47923  PyObject *tmp = v;
47924  v = PyNumber_Long(tmp);
47925  Py_DECREF(tmp);
47926  }
47927  #endif
47928  if (likely(v)) {
47929  int one = 1; int is_little = (int)*(unsigned char *)&one;
47930  unsigned char *bytes = (unsigned char *)&val;
47931  int ret = _PyLong_AsByteArray((PyLongObject *)v,
47932  bytes, sizeof(val),
47933  is_little, !is_unsigned);
47934  Py_DECREF(v);
47935  if (likely(!ret))
47936  return val;
47937  }
47938 #endif
47939  return (long) -1;
47940  }
47941  } else {
47942  long val;
47943  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
47944  if (!tmp) return (long) -1;
47945  val = __Pyx_PyInt_As_long(tmp);
47946  Py_DECREF(tmp);
47947  return val;
47948  }
47949 raise_overflow:
47950  PyErr_SetString(PyExc_OverflowError,
47951  "value too large to convert to long");
47952  return (long) -1;
47953 raise_neg_overflow:
47954  PyErr_SetString(PyExc_OverflowError,
47955  "can't convert negative value to long");
47956  return (long) -1;
47957 }
47958 
47959 /* CIntFromPy */
47960  static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) {
47961  const char neg_one = (char) ((char) 0 - (char) 1), const_zero = (char) 0;
47962  const int is_unsigned = neg_one > const_zero;
47963 #if PY_MAJOR_VERSION < 3
47964  if (likely(PyInt_Check(x))) {
47965  if (sizeof(char) < sizeof(long)) {
47966  __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x))
47967  } else {
47968  long val = PyInt_AS_LONG(x);
47969  if (is_unsigned && unlikely(val < 0)) {
47970  goto raise_neg_overflow;
47971  }
47972  return (char) val;
47973  }
47974  } else
47975 #endif
47976  if (likely(PyLong_Check(x))) {
47977  if (is_unsigned) {
47978 #if CYTHON_USE_PYLONG_INTERNALS
47979  const digit* digits = ((PyLongObject*)x)->ob_digit;
47980  switch (Py_SIZE(x)) {
47981  case 0: return (char) 0;
47982  case 1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0])
47983  case 2:
47984  if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
47985  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
47986  __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47987  } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) {
47988  return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
47989  }
47990  }
47991  break;
47992  case 3:
47993  if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
47994  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
47995  __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
47996  } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) {
47997  return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
47998  }
47999  }
48000  break;
48001  case 4:
48002  if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
48003  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
48004  __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
48005  } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) {
48006  return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
48007  }
48008  }
48009  break;
48010  }
48011 #endif
48012 #if CYTHON_COMPILING_IN_CPYTHON
48013  if (unlikely(Py_SIZE(x) < 0)) {
48014  goto raise_neg_overflow;
48015  }
48016 #else
48017  {
48018  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
48019  if (unlikely(result < 0))
48020  return (char) -1;
48021  if (unlikely(result == 1))
48022  goto raise_neg_overflow;
48023  }
48024 #endif
48025  if (sizeof(char) <= sizeof(unsigned long)) {
48026  __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x))
48027 #ifdef HAVE_LONG_LONG
48028  } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
48029  __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
48030 #endif
48031  }
48032  } else {
48033 #if CYTHON_USE_PYLONG_INTERNALS
48034  const digit* digits = ((PyLongObject*)x)->ob_digit;
48035  switch (Py_SIZE(x)) {
48036  case 0: return (char) 0;
48037  case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0]))
48038  case 1: __PYX_VERIFY_RETURN_INT(char, digit, +digits[0])
48039  case -2:
48040  if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) {
48041  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
48042  __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
48043  } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
48044  return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
48045  }
48046  }
48047  break;
48048  case 2:
48049  if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
48050  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
48051  __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
48052  } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
48053  return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
48054  }
48055  }
48056  break;
48057  case -3:
48058  if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
48059  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
48060  __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
48061  } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
48062  return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
48063  }
48064  }
48065  break;
48066  case 3:
48067  if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
48068  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
48069  __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
48070  } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
48071  return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
48072  }
48073  }
48074  break;
48075  case -4:
48076  if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
48077  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
48078  __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
48079  } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
48080  return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
48081  }
48082  }
48083  break;
48084  case 4:
48085  if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
48086  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
48087  __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
48088  } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
48089  return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
48090  }
48091  }
48092  break;
48093  }
48094 #endif
48095  if (sizeof(char) <= sizeof(long)) {
48096  __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x))
48097 #ifdef HAVE_LONG_LONG
48098  } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) {
48099  __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x))
48100 #endif
48101  }
48102  }
48103  {
48104 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
48105  PyErr_SetString(PyExc_RuntimeError,
48106  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
48107 #else
48108  char val;
48109  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
48110  #if PY_MAJOR_VERSION < 3
48111  if (likely(v) && !PyLong_Check(v)) {
48112  PyObject *tmp = v;
48113  v = PyNumber_Long(tmp);
48114  Py_DECREF(tmp);
48115  }
48116  #endif
48117  if (likely(v)) {
48118  int one = 1; int is_little = (int)*(unsigned char *)&one;
48119  unsigned char *bytes = (unsigned char *)&val;
48120  int ret = _PyLong_AsByteArray((PyLongObject *)v,
48121  bytes, sizeof(val),
48122  is_little, !is_unsigned);
48123  Py_DECREF(v);
48124  if (likely(!ret))
48125  return val;
48126  }
48127 #endif
48128  return (char) -1;
48129  }
48130  } else {
48131  char val;
48132  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
48133  if (!tmp) return (char) -1;
48134  val = __Pyx_PyInt_As_char(tmp);
48135  Py_DECREF(tmp);
48136  return val;
48137  }
48138 raise_overflow:
48139  PyErr_SetString(PyExc_OverflowError,
48140  "value too large to convert to char");
48141  return (char) -1;
48142 raise_neg_overflow:
48143  PyErr_SetString(PyExc_OverflowError,
48144  "can't convert negative value to char");
48145  return (char) -1;
48146 }
48147 
48148 /* FetchCommonType */
48149  static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
48150  PyObject* fake_module;
48151  PyTypeObject* cached_type = NULL;
48152  fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
48153  if (!fake_module) return NULL;
48154  Py_INCREF(fake_module);
48155  cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
48156  if (cached_type) {
48157  if (!PyType_Check((PyObject*)cached_type)) {
48158  PyErr_Format(PyExc_TypeError,
48159  "Shared Cython type %.200s is not a type object",
48160  type->tp_name);
48161  goto bad;
48162  }
48163  if (cached_type->tp_basicsize != type->tp_basicsize) {
48164  PyErr_Format(PyExc_TypeError,
48165  "Shared Cython type %.200s has the wrong size, try recompiling",
48166  type->tp_name);
48167  goto bad;
48168  }
48169  } else {
48170  if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
48171  PyErr_Clear();
48172  if (PyType_Ready(type) < 0) goto bad;
48173  if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
48174  goto bad;
48175  Py_INCREF(type);
48176  cached_type = type;
48177  }
48178 done:
48179  Py_DECREF(fake_module);
48180  return cached_type;
48181 bad:
48182  Py_XDECREF(cached_type);
48183  cached_type = NULL;
48184  goto done;
48185 }
48186 
48187 /* PyObjectGetMethod */
48188  static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
48189  PyObject *attr;
48190 #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
48191  PyTypeObject *tp = Py_TYPE(obj);
48192  PyObject *descr;
48193  descrgetfunc f = NULL;
48194  PyObject **dictptr, *dict;
48195  int meth_found = 0;
48196  assert (*method == NULL);
48197  if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
48198  attr = __Pyx_PyObject_GetAttrStr(obj, name);
48199  goto try_unpack;
48200  }
48201  if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
48202  return 0;
48203  }
48204  descr = _PyType_Lookup(tp, name);
48205  if (likely(descr != NULL)) {
48206  Py_INCREF(descr);
48207 #if PY_MAJOR_VERSION >= 3
48208  #ifdef __Pyx_CyFunction_USED
48209  if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
48210  #else
48211  if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
48212  #endif
48213 #else
48214  #ifdef __Pyx_CyFunction_USED
48215  if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
48216  #else
48217  if (likely(PyFunction_Check(descr)))
48218  #endif
48219 #endif
48220  {
48221  meth_found = 1;
48222  } else {
48223  f = Py_TYPE(descr)->tp_descr_get;
48224  if (f != NULL && PyDescr_IsData(descr)) {
48225  attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
48226  Py_DECREF(descr);
48227  goto try_unpack;
48228  }
48229  }
48230  }
48231  dictptr = _PyObject_GetDictPtr(obj);
48232  if (dictptr != NULL && (dict = *dictptr) != NULL) {
48233  Py_INCREF(dict);
48234  attr = __Pyx_PyDict_GetItemStr(dict, name);
48235  if (attr != NULL) {
48236  Py_INCREF(attr);
48237  Py_DECREF(dict);
48238  Py_XDECREF(descr);
48239  goto try_unpack;
48240  }
48241  Py_DECREF(dict);
48242  }
48243  if (meth_found) {
48244  *method = descr;
48245  return 1;
48246  }
48247  if (f != NULL) {
48248  attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
48249  Py_DECREF(descr);
48250  goto try_unpack;
48251  }
48252  if (descr != NULL) {
48253  *method = descr;
48254  return 0;
48255  }
48256  PyErr_Format(PyExc_AttributeError,
48257 #if PY_MAJOR_VERSION >= 3
48258  "'%.50s' object has no attribute '%U'",
48259  tp->tp_name, name);
48260 #else
48261  "'%.50s' object has no attribute '%.400s'",
48262  tp->tp_name, PyString_AS_STRING(name));
48263 #endif
48264  return 0;
48265 #else
48266  attr = __Pyx_PyObject_GetAttrStr(obj, name);
48267  goto try_unpack;
48268 #endif
48269 try_unpack:
48270 #if CYTHON_UNPACK_METHODS
48271  if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
48272  PyObject *function = PyMethod_GET_FUNCTION(attr);
48273  Py_INCREF(function);
48274  Py_DECREF(attr);
48275  *method = function;
48276  return 1;
48277  }
48278 #endif
48279  *method = attr;
48280  return 0;
48281 }
48282 
48283 /* PyObjectCallMethod1 */
48284  static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
48285  PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
48286  Py_DECREF(method);
48287  return result;
48288 }
48289 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
48290  PyObject *method = NULL, *result;
48291  int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
48292  if (likely(is_method)) {
48293  result = __Pyx_PyObject_Call2Args(method, obj, arg);
48294  Py_DECREF(method);
48295  return result;
48296  }
48297  if (unlikely(!method)) return NULL;
48298  return __Pyx__PyObject_CallMethod1(method, arg);
48299 }
48300 
48301 /* CoroutineBase */
48302  #include <structmember.h>
48303 #include <frameobject.h>
48304 #define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
48305 static int __Pyx_PyGen__FetchStopIterationValue(CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject **pvalue) {
48306  PyObject *et, *ev, *tb;
48307  PyObject *value = NULL;
48308  __Pyx_ErrFetch(&et, &ev, &tb);
48309  if (!et) {
48310  Py_XDECREF(tb);
48311  Py_XDECREF(ev);
48312  Py_INCREF(Py_None);
48313  *pvalue = Py_None;
48314  return 0;
48315  }
48316  if (likely(et == PyExc_StopIteration)) {
48317  if (!ev) {
48318  Py_INCREF(Py_None);
48319  value = Py_None;
48320  }
48321 #if PY_VERSION_HEX >= 0x030300A0
48322  else if (Py_TYPE(ev) == (PyTypeObject*)PyExc_StopIteration) {
48323  value = ((PyStopIterationObject *)ev)->value;
48324  Py_INCREF(value);
48325  Py_DECREF(ev);
48326  }
48327 #endif
48328  else if (unlikely(PyTuple_Check(ev))) {
48329  if (PyTuple_GET_SIZE(ev) >= 1) {
48330 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
48331  value = PyTuple_GET_ITEM(ev, 0);
48332  Py_INCREF(value);
48333 #else
48334  value = PySequence_ITEM(ev, 0);
48335 #endif
48336  } else {
48337  Py_INCREF(Py_None);
48338  value = Py_None;
48339  }
48340  Py_DECREF(ev);
48341  }
48342  else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
48343  value = ev;
48344  }
48345  if (likely(value)) {
48346  Py_XDECREF(tb);
48347  Py_DECREF(et);
48348  *pvalue = value;
48349  return 0;
48350  }
48351  } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
48352  __Pyx_ErrRestore(et, ev, tb);
48353  return -1;
48354  }
48355  PyErr_NormalizeException(&et, &ev, &tb);
48356  if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
48357  __Pyx_ErrRestore(et, ev, tb);
48358  return -1;
48359  }
48360  Py_XDECREF(tb);
48361  Py_DECREF(et);
48362 #if PY_VERSION_HEX >= 0x030300A0
48363  value = ((PyStopIterationObject *)ev)->value;
48364  Py_INCREF(value);
48365  Py_DECREF(ev);
48366 #else
48367  {
48368  PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args_2);
48369  Py_DECREF(ev);
48370  if (likely(args)) {
48371  value = PySequence_GetItem(args, 0);
48372  Py_DECREF(args);
48373  }
48374  if (unlikely(!value)) {
48375  __Pyx_ErrRestore(NULL, NULL, NULL);
48376  Py_INCREF(Py_None);
48377  value = Py_None;
48378  }
48379  }
48380 #endif
48381  *pvalue = value;
48382  return 0;
48383 }
48384 static CYTHON_INLINE
48385 void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) {
48386  PyObject *t, *v, *tb;
48387  t = exc_state->exc_type;
48388  v = exc_state->exc_value;
48389  tb = exc_state->exc_traceback;
48390  exc_state->exc_type = NULL;
48391  exc_state->exc_value = NULL;
48392  exc_state->exc_traceback = NULL;
48393  Py_XDECREF(t);
48394  Py_XDECREF(v);
48395  Py_XDECREF(tb);
48396 }
48397 #define __Pyx_Coroutine_AlreadyRunningError(gen) (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL)
48398 static void __Pyx__Coroutine_AlreadyRunningError(CYTHON_UNUSED __pyx_CoroutineObject *gen) {
48399  const char *msg;
48400  if ((0)) {
48401  #ifdef __Pyx_Coroutine_USED
48402  } else if (__Pyx_Coroutine_Check((PyObject*)gen)) {
48403  msg = "coroutine already executing";
48404  #endif
48405  #ifdef __Pyx_AsyncGen_USED
48406  } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) {
48407  msg = "async generator already executing";
48408  #endif
48409  } else {
48410  msg = "generator already executing";
48411  }
48412  PyErr_SetString(PyExc_ValueError, msg);
48413 }
48414 #define __Pyx_Coroutine_NotStartedError(gen) (__Pyx__Coroutine_NotStartedError(gen), (PyObject*)NULL)
48415 static void __Pyx__Coroutine_NotStartedError(CYTHON_UNUSED PyObject *gen) {
48416  const char *msg;
48417  if ((0)) {
48418  #ifdef __Pyx_Coroutine_USED
48419  } else if (__Pyx_Coroutine_Check(gen)) {
48420  msg = "can't send non-None value to a just-started coroutine";
48421  #endif
48422  #ifdef __Pyx_AsyncGen_USED
48423  } else if (__Pyx_AsyncGen_CheckExact(gen)) {
48424  msg = "can't send non-None value to a just-started async generator";
48425  #endif
48426  } else {
48427  msg = "can't send non-None value to a just-started generator";
48428  }
48429  PyErr_SetString(PyExc_TypeError, msg);
48430 }
48431 #define __Pyx_Coroutine_AlreadyTerminatedError(gen, value, closing) (__Pyx__Coroutine_AlreadyTerminatedError(gen, value, closing), (PyObject*)NULL)
48432 static void __Pyx__Coroutine_AlreadyTerminatedError(CYTHON_UNUSED PyObject *gen, PyObject *value, CYTHON_UNUSED int closing) {
48433  #ifdef __Pyx_Coroutine_USED
48434  if (!closing && __Pyx_Coroutine_Check(gen)) {
48435  PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine");
48436  } else
48437  #endif
48438  if (value) {
48439  #ifdef __Pyx_AsyncGen_USED
48440  if (__Pyx_AsyncGen_CheckExact(gen))
48441  PyErr_SetNone(__Pyx_PyExc_StopAsyncIteration);
48442  else
48443  #endif
48444  PyErr_SetNone(PyExc_StopIteration);
48445  }
48446 }
48447 static
48448 PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, int closing) {
48449  __Pyx_PyThreadState_declare
48450  PyThreadState *tstate;
48451  __Pyx_ExcInfoStruct *exc_state;
48452  PyObject *retval;
48453  assert(!self->is_running);
48454  if (unlikely(self->resume_label == 0)) {
48455  if (unlikely(value && value != Py_None)) {
48456  return __Pyx_Coroutine_NotStartedError((PyObject*)self);
48457  }
48458  }
48459  if (unlikely(self->resume_label == -1)) {
48460  return __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
48461  }
48462 #if CYTHON_FAST_THREAD_STATE
48463  __Pyx_PyThreadState_assign
48464  tstate = __pyx_tstate;
48465 #else
48466  tstate = __Pyx_PyThreadState_Current;
48467 #endif
48468  exc_state = &self->gi_exc_state;
48469  if (exc_state->exc_type) {
48470  #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
48471  #else
48472  if (exc_state->exc_traceback) {
48473  PyTracebackObject *tb = (PyTracebackObject *) exc_state->exc_traceback;
48474  PyFrameObject *f = tb->tb_frame;
48475  Py_XINCREF(tstate->frame);
48476  assert(f->f_back == NULL);
48477  f->f_back = tstate->frame;
48478  }
48479  #endif
48480  }
48481 #if CYTHON_USE_EXC_INFO_STACK
48482  exc_state->previous_item = tstate->exc_info;
48483  tstate->exc_info = exc_state;
48484 #else
48485  if (exc_state->exc_type) {
48486  __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
48487  } else {
48488  __Pyx_Coroutine_ExceptionClear(exc_state);
48489  __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
48490  }
48491 #endif
48492  self->is_running = 1;
48493  retval = self->body((PyObject *) self, tstate, value);
48494  self->is_running = 0;
48495 #if CYTHON_USE_EXC_INFO_STACK
48496  exc_state = &self->gi_exc_state;
48497  tstate->exc_info = exc_state->previous_item;
48498  exc_state->previous_item = NULL;
48499  __Pyx_Coroutine_ResetFrameBackpointer(exc_state);
48500 #endif
48501  return retval;
48502 }
48503 static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) {
48504  PyObject *exc_tb = exc_state->exc_traceback;
48505  if (likely(exc_tb)) {
48506 #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
48507 #else
48508  PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
48509  PyFrameObject *f = tb->tb_frame;
48510  Py_CLEAR(f->f_back);
48511 #endif
48512  }
48513 }
48514 static CYTHON_INLINE
48515 PyObject *__Pyx_Coroutine_MethodReturn(CYTHON_UNUSED PyObject* gen, PyObject *retval) {
48516  if (unlikely(!retval)) {
48517  __Pyx_PyThreadState_declare
48518  __Pyx_PyThreadState_assign
48519  if (!__Pyx_PyErr_Occurred()) {
48520  PyObject *exc = PyExc_StopIteration;
48521  #ifdef __Pyx_AsyncGen_USED
48522  if (__Pyx_AsyncGen_CheckExact(gen))
48523  exc = __Pyx_PyExc_StopAsyncIteration;
48524  #endif
48525  __Pyx_PyErr_SetNone(exc);
48526  }
48527  }
48528  return retval;
48529 }
48530 static CYTHON_INLINE
48531 PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) {
48532  PyObject *ret;
48533  PyObject *val = NULL;
48534  __Pyx_Coroutine_Undelegate(gen);
48535  __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val);
48536  ret = __Pyx_Coroutine_SendEx(gen, val, 0);
48537  Py_XDECREF(val);
48538  return ret;
48539 }
48540 static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
48541  PyObject *retval;
48542  __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
48543  PyObject *yf = gen->yieldfrom;
48544  if (unlikely(gen->is_running))
48545  return __Pyx_Coroutine_AlreadyRunningError(gen);
48546  if (yf) {
48547  PyObject *ret;
48548  gen->is_running = 1;
48549  #ifdef __Pyx_Generator_USED
48550  if (__Pyx_Generator_CheckExact(yf)) {
48551  ret = __Pyx_Coroutine_Send(yf, value);
48552  } else
48553  #endif
48554  #ifdef __Pyx_Coroutine_USED
48555  if (__Pyx_Coroutine_Check(yf)) {
48556  ret = __Pyx_Coroutine_Send(yf, value);
48557  } else
48558  #endif
48559  #ifdef __Pyx_AsyncGen_USED
48560  if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
48561  ret = __Pyx_async_gen_asend_send(yf, value);
48562  } else
48563  #endif
48564  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
48565  if (PyGen_CheckExact(yf)) {
48566  ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
48567  } else
48568  #endif
48569  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03050000 && defined(PyCoro_CheckExact) && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
48570  if (PyCoro_CheckExact(yf)) {
48571  ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
48572  } else
48573  #endif
48574  {
48575  if (value == Py_None)
48576  ret = Py_TYPE(yf)->tp_iternext(yf);
48577  else
48578  ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value);
48579  }
48580  gen->is_running = 0;
48581  if (likely(ret)) {
48582  return ret;
48583  }
48584  retval = __Pyx_Coroutine_FinishDelegation(gen);
48585  } else {
48586  retval = __Pyx_Coroutine_SendEx(gen, value, 0);
48587  }
48588  return __Pyx_Coroutine_MethodReturn(self, retval);
48589 }
48590 static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
48591  PyObject *retval = NULL;
48592  int err = 0;
48593  #ifdef __Pyx_Generator_USED
48594  if (__Pyx_Generator_CheckExact(yf)) {
48595  retval = __Pyx_Coroutine_Close(yf);
48596  if (!retval)
48597  return -1;
48598  } else
48599  #endif
48600  #ifdef __Pyx_Coroutine_USED
48601  if (__Pyx_Coroutine_Check(yf)) {
48602  retval = __Pyx_Coroutine_Close(yf);
48603  if (!retval)
48604  return -1;
48605  } else
48606  if (__Pyx_CoroutineAwait_CheckExact(yf)) {
48607  retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf, NULL);
48608  if (!retval)
48609  return -1;
48610  } else
48611  #endif
48612  #ifdef __Pyx_AsyncGen_USED
48613  if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
48614  retval = __Pyx_async_gen_asend_close(yf, NULL);
48615  } else
48616  if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
48617  retval = __Pyx_async_gen_athrow_close(yf, NULL);
48618  } else
48619  #endif
48620  {
48621  PyObject *meth;
48622  gen->is_running = 1;
48623  meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_close);
48624  if (unlikely(!meth)) {
48625  if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
48626  PyErr_WriteUnraisable(yf);
48627  }
48628  PyErr_Clear();
48629  } else {
48630  retval = PyObject_CallFunction(meth, NULL);
48631  Py_DECREF(meth);
48632  if (!retval)
48633  err = -1;
48634  }
48635  gen->is_running = 0;
48636  }
48637  Py_XDECREF(retval);
48638  return err;
48639 }
48640 static PyObject *__Pyx_Generator_Next(PyObject *self) {
48641  __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
48642  PyObject *yf = gen->yieldfrom;
48643  if (unlikely(gen->is_running))
48644  return __Pyx_Coroutine_AlreadyRunningError(gen);
48645  if (yf) {
48646  PyObject *ret;
48647  gen->is_running = 1;
48648  #ifdef __Pyx_Generator_USED
48649  if (__Pyx_Generator_CheckExact(yf)) {
48650  ret = __Pyx_Generator_Next(yf);
48651  } else
48652  #endif
48653  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
48654  if (PyGen_CheckExact(yf)) {
48655  ret = _PyGen_Send((PyGenObject*)yf, NULL);
48656  } else
48657  #endif
48658  #ifdef __Pyx_Coroutine_USED
48659  if (__Pyx_Coroutine_Check(yf)) {
48660  ret = __Pyx_Coroutine_Send(yf, Py_None);
48661  } else
48662  #endif
48663  ret = Py_TYPE(yf)->tp_iternext(yf);
48664  gen->is_running = 0;
48665  if (likely(ret)) {
48666  return ret;
48667  }
48668  return __Pyx_Coroutine_FinishDelegation(gen);
48669  }
48670  return __Pyx_Coroutine_SendEx(gen, Py_None, 0);
48671 }
48672 static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, CYTHON_UNUSED PyObject *arg) {
48673  return __Pyx_Coroutine_Close(self);
48674 }
48675 static PyObject *__Pyx_Coroutine_Close(PyObject *self) {
48676  __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
48677  PyObject *retval, *raised_exception;
48678  PyObject *yf = gen->yieldfrom;
48679  int err = 0;
48680  if (unlikely(gen->is_running))
48681  return __Pyx_Coroutine_AlreadyRunningError(gen);
48682  if (yf) {
48683  Py_INCREF(yf);
48684  err = __Pyx_Coroutine_CloseIter(gen, yf);
48685  __Pyx_Coroutine_Undelegate(gen);
48686  Py_DECREF(yf);
48687  }
48688  if (err == 0)
48689  PyErr_SetNone(PyExc_GeneratorExit);
48690  retval = __Pyx_Coroutine_SendEx(gen, NULL, 1);
48691  if (unlikely(retval)) {
48692  const char *msg;
48693  Py_DECREF(retval);
48694  if ((0)) {
48695  #ifdef __Pyx_Coroutine_USED
48696  } else if (__Pyx_Coroutine_Check(self)) {
48697  msg = "coroutine ignored GeneratorExit";
48698  #endif
48699  #ifdef __Pyx_AsyncGen_USED
48700  } else if (__Pyx_AsyncGen_CheckExact(self)) {
48701 #if PY_VERSION_HEX < 0x03060000
48702  msg = "async generator ignored GeneratorExit - might require Python 3.6+ finalisation (PEP 525)";
48703 #else
48704  msg = "async generator ignored GeneratorExit";
48705 #endif
48706  #endif
48707  } else {
48708  msg = "generator ignored GeneratorExit";
48709  }
48710  PyErr_SetString(PyExc_RuntimeError, msg);
48711  return NULL;
48712  }
48713  raised_exception = PyErr_Occurred();
48714  if (likely(!raised_exception || __Pyx_PyErr_GivenExceptionMatches2(raised_exception, PyExc_GeneratorExit, PyExc_StopIteration))) {
48715  if (raised_exception) PyErr_Clear();
48716  Py_INCREF(Py_None);
48717  return Py_None;
48718  }
48719  return NULL;
48720 }
48721 static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb,
48722  PyObject *args, int close_on_genexit) {
48723  __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
48724  PyObject *yf = gen->yieldfrom;
48725  if (unlikely(gen->is_running))
48726  return __Pyx_Coroutine_AlreadyRunningError(gen);
48727  if (yf) {
48728  PyObject *ret;
48729  Py_INCREF(yf);
48730  if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) {
48731  int err = __Pyx_Coroutine_CloseIter(gen, yf);
48732  Py_DECREF(yf);
48733  __Pyx_Coroutine_Undelegate(gen);
48734  if (err < 0)
48735  return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
48736  goto throw_here;
48737  }
48738  gen->is_running = 1;
48739  if (0
48740  #ifdef __Pyx_Generator_USED
48741  || __Pyx_Generator_CheckExact(yf)
48742  #endif
48743  #ifdef __Pyx_Coroutine_USED
48744  || __Pyx_Coroutine_Check(yf)
48745  #endif
48746  ) {
48747  ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit);
48748  #ifdef __Pyx_Coroutine_USED
48749  } else if (__Pyx_CoroutineAwait_CheckExact(yf)) {
48750  ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit);
48751  #endif
48752  } else {
48753  PyObject *meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_throw);
48754  if (unlikely(!meth)) {
48755  Py_DECREF(yf);
48756  if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
48757  gen->is_running = 0;
48758  return NULL;
48759  }
48760  PyErr_Clear();
48761  __Pyx_Coroutine_Undelegate(gen);
48762  gen->is_running = 0;
48763  goto throw_here;
48764  }
48765  if (likely(args)) {
48766  ret = PyObject_CallObject(meth, args);
48767  } else {
48768  ret = PyObject_CallFunctionObjArgs(meth, typ, val, tb, NULL);
48769  }
48770  Py_DECREF(meth);
48771  }
48772  gen->is_running = 0;
48773  Py_DECREF(yf);
48774  if (!ret) {
48775  ret = __Pyx_Coroutine_FinishDelegation(gen);
48776  }
48777  return __Pyx_Coroutine_MethodReturn(self, ret);
48778  }
48779 throw_here:
48780  __Pyx_Raise(typ, val, tb, NULL);
48781  return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
48782 }
48783 static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
48784  PyObject *typ;
48785  PyObject *val = NULL;
48786  PyObject *tb = NULL;
48787  if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
48788  return NULL;
48789  return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1);
48790 }
48791 static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) {
48792  Py_VISIT(exc_state->exc_type);
48793  Py_VISIT(exc_state->exc_value);
48794  Py_VISIT(exc_state->exc_traceback);
48795  return 0;
48796 }
48797 static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) {
48798  Py_VISIT(gen->closure);
48799  Py_VISIT(gen->classobj);
48800  Py_VISIT(gen->yieldfrom);
48801  return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg);
48802 }
48803 static int __Pyx_Coroutine_clear(PyObject *self) {
48804  __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
48805  Py_CLEAR(gen->closure);
48806  Py_CLEAR(gen->classobj);
48807  Py_CLEAR(gen->yieldfrom);
48808  __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state);
48809 #ifdef __Pyx_AsyncGen_USED
48810  if (__Pyx_AsyncGen_CheckExact(self)) {
48811  Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer);
48812  }
48813 #endif
48814  Py_CLEAR(gen->gi_code);
48815  Py_CLEAR(gen->gi_name);
48816  Py_CLEAR(gen->gi_qualname);
48817  Py_CLEAR(gen->gi_modulename);
48818  return 0;
48819 }
48820 static void __Pyx_Coroutine_dealloc(PyObject *self) {
48821  __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
48822  PyObject_GC_UnTrack(gen);
48823  if (gen->gi_weakreflist != NULL)
48824  PyObject_ClearWeakRefs(self);
48825  if (gen->resume_label >= 0) {
48826  PyObject_GC_Track(self);
48827 #if PY_VERSION_HEX >= 0x030400a1 && CYTHON_USE_TP_FINALIZE
48828  if (PyObject_CallFinalizerFromDealloc(self))
48829 #else
48830  Py_TYPE(gen)->tp_del(self);
48831  if (self->ob_refcnt > 0)
48832 #endif
48833  {
48834  return;
48835  }
48836  PyObject_GC_UnTrack(self);
48837  }
48838 #ifdef __Pyx_AsyncGen_USED
48839  if (__Pyx_AsyncGen_CheckExact(self)) {
48840  /* We have to handle this case for asynchronous generators
48841  right here, because this code has to be between UNTRACK
48842  and GC_Del. */
48843  Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer);
48844  }
48845 #endif
48846  __Pyx_Coroutine_clear(self);
48847  PyObject_GC_Del(gen);
48848 }
48849 static void __Pyx_Coroutine_del(PyObject *self) {
48850  PyObject *error_type, *error_value, *error_traceback;
48851  __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
48852  __Pyx_PyThreadState_declare
48853  if (gen->resume_label < 0) {
48854  return;
48855  }
48856 #if !CYTHON_USE_TP_FINALIZE
48857  assert(self->ob_refcnt == 0);
48858  self->ob_refcnt = 1;
48859 #endif
48860  __Pyx_PyThreadState_assign
48861  __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
48862 #ifdef __Pyx_AsyncGen_USED
48863  if (__Pyx_AsyncGen_CheckExact(self)) {
48864  __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self;
48865  PyObject *finalizer = agen->ag_finalizer;
48866  if (finalizer && !agen->ag_closed) {
48867  PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self);
48868  if (unlikely(!res)) {
48869  PyErr_WriteUnraisable(self);
48870  } else {
48871  Py_DECREF(res);
48872  }
48873  __Pyx_ErrRestore(error_type, error_value, error_traceback);
48874  return;
48875  }
48876  }
48877 #endif
48878  if (unlikely(gen->resume_label == 0 && !error_value)) {
48879 #ifdef __Pyx_Coroutine_USED
48880 #ifdef __Pyx_Generator_USED
48881  if (!__Pyx_Generator_CheckExact(self))
48882 #endif
48883  {
48884  PyObject_GC_UnTrack(self);
48885 #if PY_MAJOR_VERSION >= 3 || defined(PyErr_WarnFormat)
48886  if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
48887  PyErr_WriteUnraisable(self);
48888 #else
48889  {PyObject *msg;
48890  char *cmsg;
48891  #if CYTHON_COMPILING_IN_PYPY
48892  msg = NULL;
48893  cmsg = (char*) "coroutine was never awaited";
48894  #else
48895  char *cname;
48896  PyObject *qualname;
48897  qualname = gen->gi_qualname;
48898  cname = PyString_AS_STRING(qualname);
48899  msg = PyString_FromFormat("coroutine '%.50s' was never awaited", cname);
48900  if (unlikely(!msg)) {
48901  PyErr_Clear();
48902  cmsg = (char*) "coroutine was never awaited";
48903  } else {
48904  cmsg = PyString_AS_STRING(msg);
48905  }
48906  #endif
48907  if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, cmsg, 1) < 0))
48908  PyErr_WriteUnraisable(self);
48909  Py_XDECREF(msg);}
48910 #endif
48911  PyObject_GC_Track(self);
48912  }
48913 #endif
48914  } else {
48915  PyObject *res = __Pyx_Coroutine_Close(self);
48916  if (unlikely(!res)) {
48917  if (PyErr_Occurred())
48918  PyErr_WriteUnraisable(self);
48919  } else {
48920  Py_DECREF(res);
48921  }
48922  }
48923  __Pyx_ErrRestore(error_type, error_value, error_traceback);
48924 #if !CYTHON_USE_TP_FINALIZE
48925  assert(self->ob_refcnt > 0);
48926  if (--self->ob_refcnt == 0) {
48927  return;
48928  }
48929  {
48930  Py_ssize_t refcnt = self->ob_refcnt;
48931  _Py_NewReference(self);
48932  self->ob_refcnt = refcnt;
48933  }
48934 #if CYTHON_COMPILING_IN_CPYTHON
48935  assert(PyType_IS_GC(self->ob_type) &&
48936  _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
48937  _Py_DEC_REFTOTAL;
48938 #endif
48939 #ifdef COUNT_ALLOCS
48940  --Py_TYPE(self)->tp_frees;
48941  --Py_TYPE(self)->tp_allocs;
48942 #endif
48943 #endif
48944 }
48945 static PyObject *
48946 __Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
48947 {
48948  PyObject *name = self->gi_name;
48949  if (unlikely(!name)) name = Py_None;
48950  Py_INCREF(name);
48951  return name;
48952 }
48953 static int
48954 __Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context)
48955 {
48956  PyObject *tmp;
48957 #if PY_MAJOR_VERSION >= 3
48958  if (unlikely(value == NULL || !PyUnicode_Check(value)))
48959 #else
48960  if (unlikely(value == NULL || !PyString_Check(value)))
48961 #endif
48962  {
48963  PyErr_SetString(PyExc_TypeError,
48964  "__name__ must be set to a string object");
48965  return -1;
48966  }
48967  tmp = self->gi_name;
48968  Py_INCREF(value);
48969  self->gi_name = value;
48970  Py_XDECREF(tmp);
48971  return 0;
48972 }
48973 static PyObject *
48974 __Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
48975 {
48976  PyObject *name = self->gi_qualname;
48977  if (unlikely(!name)) name = Py_None;
48978  Py_INCREF(name);
48979  return name;
48980 }
48981 static int
48982 __Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context)
48983 {
48984  PyObject *tmp;
48985 #if PY_MAJOR_VERSION >= 3
48986  if (unlikely(value == NULL || !PyUnicode_Check(value)))
48987 #else
48988  if (unlikely(value == NULL || !PyString_Check(value)))
48989 #endif
48990  {
48991  PyErr_SetString(PyExc_TypeError,
48992  "__qualname__ must be set to a string object");
48993  return -1;
48994  }
48995  tmp = self->gi_qualname;
48996  Py_INCREF(value);
48997  self->gi_qualname = value;
48998  Py_XDECREF(tmp);
48999  return 0;
49000 }
49001 static __pyx_CoroutineObject *__Pyx__Coroutine_New(
49002  PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
49003  PyObject *name, PyObject *qualname, PyObject *module_name) {
49004  __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
49005  if (unlikely(!gen))
49006  return NULL;
49007  return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name);
49008 }
49009 static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
49010  __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
49011  PyObject *name, PyObject *qualname, PyObject *module_name) {
49012  gen->body = body;
49013  gen->closure = closure;
49014  Py_XINCREF(closure);
49015  gen->is_running = 0;
49016  gen->resume_label = 0;
49017  gen->classobj = NULL;
49018  gen->yieldfrom = NULL;
49019  gen->gi_exc_state.exc_type = NULL;
49020  gen->gi_exc_state.exc_value = NULL;
49021  gen->gi_exc_state.exc_traceback = NULL;
49022 #if CYTHON_USE_EXC_INFO_STACK
49023  gen->gi_exc_state.previous_item = NULL;
49024 #endif
49025  gen->gi_weakreflist = NULL;
49026  Py_XINCREF(qualname);
49027  gen->gi_qualname = qualname;
49028  Py_XINCREF(name);
49029  gen->gi_name = name;
49030  Py_XINCREF(module_name);
49031  gen->gi_modulename = module_name;
49032  Py_XINCREF(code);
49033  gen->gi_code = code;
49034  PyObject_GC_Track(gen);
49035  return gen;
49036 }
49037 
49038 /* PatchModuleWithCoroutine */
49039  static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) {
49040 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
49041  int result;
49042  PyObject *globals, *result_obj;
49043  globals = PyDict_New(); if (unlikely(!globals)) goto ignore;
49044  result = PyDict_SetItemString(globals, "_cython_coroutine_type",
49045  #ifdef __Pyx_Coroutine_USED
49046  (PyObject*)__pyx_CoroutineType);
49047  #else
49048  Py_None);
49049  #endif
49050  if (unlikely(result < 0)) goto ignore;
49051  result = PyDict_SetItemString(globals, "_cython_generator_type",
49052  #ifdef __Pyx_Generator_USED
49053  (PyObject*)__pyx_GeneratorType);
49054  #else
49055  Py_None);
49056  #endif
49057  if (unlikely(result < 0)) goto ignore;
49058  if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore;
49059  if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore;
49060  result_obj = PyRun_String(py_code, Py_file_input, globals, globals);
49061  if (unlikely(!result_obj)) goto ignore;
49062  Py_DECREF(result_obj);
49063  Py_DECREF(globals);
49064  return module;
49065 ignore:
49066  Py_XDECREF(globals);
49067  PyErr_WriteUnraisable(module);
49068  if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) {
49069  Py_DECREF(module);
49070  module = NULL;
49071  }
49072 #else
49073  py_code++;
49074 #endif
49075  return module;
49076 }
49077 
49078 /* PatchGeneratorABC */
49079  #ifndef CYTHON_REGISTER_ABCS
49080 #define CYTHON_REGISTER_ABCS 1
49081 #endif
49082 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
49083 static PyObject* __Pyx_patch_abc_module(PyObject *module);
49084 static PyObject* __Pyx_patch_abc_module(PyObject *module) {
49085  module = __Pyx_Coroutine_patch_module(
49086  module, ""
49087 "if _cython_generator_type is not None:\n"
49088 " try: Generator = _module.Generator\n"
49089 " except AttributeError: pass\n"
49090 " else: Generator.register(_cython_generator_type)\n"
49091 "if _cython_coroutine_type is not None:\n"
49092 " try: Coroutine = _module.Coroutine\n"
49093 " except AttributeError: pass\n"
49094 " else: Coroutine.register(_cython_coroutine_type)\n"
49095  );
49096  return module;
49097 }
49098 #endif
49099 static int __Pyx_patch_abc(void) {
49100 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
49101  static int abc_patched = 0;
49102  if (CYTHON_REGISTER_ABCS && !abc_patched) {
49103  PyObject *module;
49104  module = PyImport_ImportModule((PY_MAJOR_VERSION >= 3) ? "collections.abc" : "collections");
49105  if (!module) {
49106  PyErr_WriteUnraisable(NULL);
49107  if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning,
49108  ((PY_MAJOR_VERSION >= 3) ?
49109  "Cython module failed to register with collections.abc module" :
49110  "Cython module failed to register with collections module"), 1) < 0)) {
49111  return -1;
49112  }
49113  } else {
49114  module = __Pyx_patch_abc_module(module);
49115  abc_patched = 1;
49116  if (unlikely(!module))
49117  return -1;
49118  Py_DECREF(module);
49119  }
49120  module = PyImport_ImportModule("backports_abc");
49121  if (module) {
49122  module = __Pyx_patch_abc_module(module);
49123  Py_XDECREF(module);
49124  }
49125  if (!module) {
49126  PyErr_Clear();
49127  }
49128  }
49129 #else
49130  if ((0)) __Pyx_Coroutine_patch_module(NULL, NULL);
49131 #endif
49132  return 0;
49133 }
49134 
49135 /* Generator */
49136  static PyMethodDef __pyx_Generator_methods[] = {
49137  {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
49138  (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
49139  {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
49140  (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
49141  {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
49142  (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
49143  {0, 0, 0, 0}
49144 };
49145 static PyMemberDef __pyx_Generator_memberlist[] = {
49146  {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL},
49147  {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
49148  (char*) PyDoc_STR("object being iterated by 'yield from', or None")},
49149  {(char*) "gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
49150  {0, 0, 0, 0, 0}
49151 };
49152 static PyGetSetDef __pyx_Generator_getsets[] = {
49153  {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
49154  (char*) PyDoc_STR("name of the generator"), 0},
49155  {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
49156  (char*) PyDoc_STR("qualified name of the generator"), 0},
49157  {0, 0, 0, 0, 0}
49158 };
49159 static PyTypeObject __pyx_GeneratorType_type = {
49160  PyVarObject_HEAD_INIT(0, 0)
49161  "generator",
49162  sizeof(__pyx_CoroutineObject),
49163  0,
49164  (destructor) __Pyx_Coroutine_dealloc,
49165  0,
49166  0,
49167  0,
49168  0,
49169  0,
49170  0,
49171  0,
49172  0,
49173  0,
49174  0,
49175  0,
49176  0,
49177  0,
49178  0,
49179  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
49180  0,
49181  (traverseproc) __Pyx_Coroutine_traverse,
49182  0,
49183  0,
49184  offsetof(__pyx_CoroutineObject, gi_weakreflist),
49185  0,
49186  (iternextfunc) __Pyx_Generator_Next,
49187  __pyx_Generator_methods,
49188  __pyx_Generator_memberlist,
49189  __pyx_Generator_getsets,
49190  0,
49191  0,
49192  0,
49193  0,
49194  0,
49195  0,
49196  0,
49197  0,
49198  0,
49199  0,
49200  0,
49201  0,
49202  0,
49203  0,
49204  0,
49205 #if CYTHON_USE_TP_FINALIZE
49206  0,
49207 #else
49208  __Pyx_Coroutine_del,
49209 #endif
49210  0,
49211 #if CYTHON_USE_TP_FINALIZE
49212  __Pyx_Coroutine_del,
49213 #elif PY_VERSION_HEX >= 0x030400a1
49214  0,
49215 #endif
49216 #if PY_VERSION_HEX >= 0x030800b1
49217  0,
49218 #endif
49219 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
49220  0,
49221 #endif
49222 };
49223 static int __pyx_Generator_init(void) {
49224  __pyx_GeneratorType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
49225  __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
49226  __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type);
49227  if (unlikely(!__pyx_GeneratorType)) {
49228  return -1;
49229  }
49230  return 0;
49231 }
49232 
49233 /* CheckBinaryVersion */
49234  static int __Pyx_check_binary_version(void) {
49235  char ctversion[4], rtversion[4];
49236  PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
49237  PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
49238  if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
49239  char message[200];
49240  PyOS_snprintf(message, sizeof(message),
49241  "compiletime version %s of module '%.100s' "
49242  "does not match runtime version %s",
49243  ctversion, __Pyx_MODULE_NAME, rtversion);
49244  return PyErr_WarnEx(NULL, message, 1);
49245  }
49246  return 0;
49247 }
49248 
49249 /* FunctionExport */
49250  static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
49251  PyObject *d = 0;
49252  PyObject *cobj = 0;
49253  union {
49254  void (*fp)(void);
49255  void *p;
49256  } tmp;
49257  d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
49258  if (!d) {
49259  PyErr_Clear();
49260  d = PyDict_New();
49261  if (!d)
49262  goto bad;
49263  Py_INCREF(d);
49264  if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
49265  goto bad;
49266  }
49267  tmp.fp = f;
49268 #if PY_VERSION_HEX >= 0x02070000
49269  cobj = PyCapsule_New(tmp.p, sig, 0);
49270 #else
49271  cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0);
49272 #endif
49273  if (!cobj)
49274  goto bad;
49275  if (PyDict_SetItemString(d, name, cobj) < 0)
49276  goto bad;
49277  Py_DECREF(cobj);
49278  Py_DECREF(d);
49279  return 0;
49280 bad:
49281  Py_XDECREF(cobj);
49282  Py_XDECREF(d);
49283  return -1;
49284 }
49285 
49286 /* InitStrings */
49287  static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
49288  while (t->p) {
49289  #if PY_MAJOR_VERSION < 3
49290  if (t->is_unicode) {
49291  *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
49292  } else if (t->intern) {
49293  *t->p = PyString_InternFromString(t->s);
49294  } else {
49295  *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
49296  }
49297  #else
49298  if (t->is_unicode | t->is_str) {
49299  if (t->intern) {
49300  *t->p = PyUnicode_InternFromString(t->s);
49301  } else if (t->encoding) {
49302  *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
49303  } else {
49304  *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
49305  }
49306  } else {
49307  *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
49308  }
49309  #endif
49310  if (!*t->p)
49311  return -1;
49312  if (PyObject_Hash(*t->p) == -1)
49313  return -1;
49314  ++t;
49315  }
49316  return 0;
49317 }
49318 
49319 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
49320  return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
49321 }
49322 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
49323  Py_ssize_t ignore;
49324  return __Pyx_PyObject_AsStringAndSize(o, &ignore);
49325 }
49326 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
49327 #if !CYTHON_PEP393_ENABLED
49328 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
49329  char* defenc_c;
49330  PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
49331  if (!defenc) return NULL;
49332  defenc_c = PyBytes_AS_STRING(defenc);
49333 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
49334  {
49335  char* end = defenc_c + PyBytes_GET_SIZE(defenc);
49336  char* c;
49337  for (c = defenc_c; c < end; c++) {
49338  if ((unsigned char) (*c) >= 128) {
49339  PyUnicode_AsASCIIString(o);
49340  return NULL;
49341  }
49342  }
49343  }
49344 #endif
49345  *length = PyBytes_GET_SIZE(defenc);
49346  return defenc_c;
49347 }
49348 #else
49349 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
49350  if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
49351 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
49352  if (likely(PyUnicode_IS_ASCII(o))) {
49353  *length = PyUnicode_GET_LENGTH(o);
49354  return PyUnicode_AsUTF8(o);
49355  } else {
49356  PyUnicode_AsASCIIString(o);
49357  return NULL;
49358  }
49359 #else
49360  return PyUnicode_AsUTF8AndSize(o, length);
49361 #endif
49362 }
49363 #endif
49364 #endif
49365 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
49366 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
49367  if (
49368 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
49369  __Pyx_sys_getdefaultencoding_not_ascii &&
49370 #endif
49371  PyUnicode_Check(o)) {
49372  return __Pyx_PyUnicode_AsStringAndSize(o, length);
49373  } else
49374 #endif
49375 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
49376  if (PyByteArray_Check(o)) {
49377  *length = PyByteArray_GET_SIZE(o);
49378  return PyByteArray_AS_STRING(o);
49379  } else
49380 #endif
49381  {
49382  char* result;
49383  int r = PyBytes_AsStringAndSize(o, &result, length);
49384  if (unlikely(r < 0)) {
49385  return NULL;
49386  } else {
49387  return result;
49388  }
49389  }
49390 }
49391 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
49392  int is_true = x == Py_True;
49393  if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
49394  else return PyObject_IsTrue(x);
49395 }
49396 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
49397  int retval;
49398  if (unlikely(!x)) return -1;
49399  retval = __Pyx_PyObject_IsTrue(x);
49400  Py_DECREF(x);
49401  return retval;
49402 }
49403 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
49404 #if PY_MAJOR_VERSION >= 3
49405  if (PyLong_Check(result)) {
49406  if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
49407  "__int__ returned non-int (type %.200s). "
49408  "The ability to return an instance of a strict subclass of int "
49409  "is deprecated, and may be removed in a future version of Python.",
49410  Py_TYPE(result)->tp_name)) {
49411  Py_DECREF(result);
49412  return NULL;
49413  }
49414  return result;
49415  }
49416 #endif
49417  PyErr_Format(PyExc_TypeError,
49418  "__%.4s__ returned non-%.4s (type %.200s)",
49419  type_name, type_name, Py_TYPE(result)->tp_name);
49420  Py_DECREF(result);
49421  return NULL;
49422 }
49423 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
49424 #if CYTHON_USE_TYPE_SLOTS
49425  PyNumberMethods *m;
49426 #endif
49427  const char *name = NULL;
49428  PyObject *res = NULL;
49429 #if PY_MAJOR_VERSION < 3
49430  if (likely(PyInt_Check(x) || PyLong_Check(x)))
49431 #else
49432  if (likely(PyLong_Check(x)))
49433 #endif
49434  return __Pyx_NewRef(x);
49435 #if CYTHON_USE_TYPE_SLOTS
49436  m = Py_TYPE(x)->tp_as_number;
49437  #if PY_MAJOR_VERSION < 3
49438  if (m && m->nb_int) {
49439  name = "int";
49440  res = m->nb_int(x);
49441  }
49442  else if (m && m->nb_long) {
49443  name = "long";
49444  res = m->nb_long(x);
49445  }
49446  #else
49447  if (likely(m && m->nb_int)) {
49448  name = "int";
49449  res = m->nb_int(x);
49450  }
49451  #endif
49452 #else
49453  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
49454  res = PyNumber_Int(x);
49455  }
49456 #endif
49457  if (likely(res)) {
49458 #if PY_MAJOR_VERSION < 3
49459  if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
49460 #else
49461  if (unlikely(!PyLong_CheckExact(res))) {
49462 #endif
49463  return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
49464  }
49465  }
49466  else if (!PyErr_Occurred()) {
49467  PyErr_SetString(PyExc_TypeError,
49468  "an integer is required");
49469  }
49470  return res;
49471 }
49472 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
49473  Py_ssize_t ival;
49474  PyObject *x;
49475 #if PY_MAJOR_VERSION < 3
49476  if (likely(PyInt_CheckExact(b))) {
49477  if (sizeof(Py_ssize_t) >= sizeof(long))
49478  return PyInt_AS_LONG(b);
49479  else
49480  return PyInt_AsSsize_t(b);
49481  }
49482 #endif
49483  if (likely(PyLong_CheckExact(b))) {
49484  #if CYTHON_USE_PYLONG_INTERNALS
49485  const digit* digits = ((PyLongObject*)b)->ob_digit;
49486  const Py_ssize_t size = Py_SIZE(b);
49487  if (likely(__Pyx_sst_abs(size) <= 1)) {
49488  ival = likely(size) ? digits[0] : 0;
49489  if (size == -1) ival = -ival;
49490  return ival;
49491  } else {
49492  switch (size) {
49493  case 2:
49494  if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
49495  return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
49496  }
49497  break;
49498  case -2:
49499  if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
49500  return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
49501  }
49502  break;
49503  case 3:
49504  if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
49505  return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
49506  }
49507  break;
49508  case -3:
49509  if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
49510  return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
49511  }
49512  break;
49513  case 4:
49514  if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
49515  return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
49516  }
49517  break;
49518  case -4:
49519  if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
49520  return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
49521  }
49522  break;
49523  }
49524  }
49525  #endif
49526  return PyLong_AsSsize_t(b);
49527  }
49528  x = PyNumber_Index(b);
49529  if (!x) return -1;
49530  ival = PyInt_AsSsize_t(x);
49531  Py_DECREF(x);
49532  return ival;
49533 }
49534 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
49535  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
49536 }
49537 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
49538  return PyInt_FromSize_t(ival);
49539 }
49540 
49541 
49542 #endif /* Py_PYTHON_H */
Double c
Definition: Headers.h:53
Double f
Definition: Headers.h:53
double pos(double a)
Double * z
Definition: Headers.h:40
double fp(const double &g, const double &h, const double &hZ)
Definition: GN_SW2DCV.h:96
Int n
Definition: Headers.h:27
Double s
Definition: Headers.h:53
Int number
Definition: Headers.h:27
Double u
Definition: Headers.h:53
Double L
Definition: Headers.h:53
Double v
Definition: Headers.h:53
Double r
Definition: Headers.h:53
Double T
Definition: Headers.h:53
Double U
Definition: Headers.h:53